Ok, thanks. I think my problem is that I'm worrying, unnecessarily it seems, about the GET request versus the POST request. I'm coming from Spring MVC where I used the method that handled the GET request for when I did the rehydrate work. Then in the POST method (in the same class) the validating and binding happened.
With Spring MVC, if your GET handling method didn't specifically ask for the request parameters, whatever ones were in the request were ignored. With Stripes it appears that the request parameters are always processed. GET and POST are no longer a part of the picture. Something about this confuses me. Brandon Atkinson wrote: > There's nothing wrong with using @After rather than @Before. > > The fact that you are asking the question hints at the possibility that > you don't really have a good idea of when the lifecycle events occur, > which could be a problem. If you're going to schedule an event before > or after some other event, you should probably know what occurs at each > step. > > Read this, if you haven't already: > http://stripesframework.org/display/stripes/Lifecycles+Etc. > > If it's still not clear when to schedule your event, the stripes source > code is excellent, and highly readable. My suggestion would be to have > a look at the DispatchHelper class. > > So given that you really do need to understand the lifecycle to > effectively use the @Before and @After annotations, I would suggest > using @Before when you need to initialize data for an operation. Use > @After when you need to do some clean up following an operation. > > There are, of course, exceptions. > > On Tue, Sep 22, 2009 at 10:28 PM, Rusty Wright <[email protected] > <mailto:[email protected]>> wrote: > > As per the Stripes' Best Practices page I added a rehydrate method > annotated with @Before. > > 1) I found using @Before with BindingAndValidation confusing so I > changed it to @After with HandlerResolution and that seems to work. > Is that ok? > > 2) Instead of using this @Before/@After method I had been setting up > the object in the @DefaultHanlder and that seemed to work. What are > the pros and cons of each way of doing it? > > Here are the relevant methods: > > /** > */ > @After(stages = LifecycleStage.HandlerResolution) > public void rehydrate() { > this.log.debug("called"); > > this.desiredDate = this.desiredDateFactory.create(); > > this.dateFormBacker = new DateFormBacker(); > } > > /** > * @return Resolution > */ > @DefaultHandler > public Resolution view() { > this.log.debug("desiredDate: " + this.desiredDate); > > return (new ForwardResolution("/WEB-INF/jsp/start.jsp")); > } > > /** > * @return Resolution > */ > public Resolution submit() { > this.log.debug("desiredDate: " + this.desiredDate); > > final int id = > this.dateService.saveDesiredDate(this.desiredDate); > > getContext().setDesiredDateId(Integer.valueOf(id)); > > return (new RedirectResolution("/list.zug")); > } > > Thanks > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Stripes-users mailing list > [email protected] > <mailto:[email protected]> > https://lists.sourceforge.net/lists/listinfo/stripes-users > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > > > ------------------------------------------------------------------------ > > _______________________________________________ > Stripes-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
