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
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to