Just a heads up I think most of us would agree that the event method is the last place we put validation. I truly expect that all input data is valid by the time it gets to an event handler.
Here is my preferred order Field Level @Validate or @ValidateNestedProperties Method @ValidationMethod Finally if there is no other way custom validation code in the event handler. My 2 cents Nathan On Thu, Aug 12, 2010 at 7:57 PM, Aaron Stromas <passog...@gmail.com> wrote: > > On 12 August 2010 16:00, Freddy Daoud <xf2...@fastmail.fm> wrote: >> >> Aaron, >> >> > It appears that errors added to the ValidationErrors within event >> > handlers are not rendered. Is that true? I that related to life >> > cycle? >> >> Again, when a validation error occurs, >> the target event handler is *not* invoked and the Resolution that is >> returned by getContext().getSourcePageResolution() is used instead. >> >> So your event handler is not called unless all other validations >> pass. Then, you can do further validations and add errors to >> ValidationErrors, and return getContext().getSourcePageResolution() >> which should render the errors that you added. >> >> Cheers, >> Freddy >> > Hi Freddy, > > I did not make myself clear, there are no validation methods that interrupt > the life cycle. I do my validation in the event handler. Something like > this: > > public Resolution handle() { > if (isInvalid()) > return new RedirectResolution(getClass()); > > ... > return new ForwardResolution(SOME_PAGE); > } > > @DefaultHandler > public Resolution view() { > ... > } > > private boolean isInvalid() { > getContext().getValidationErrors().add("foo", new LocalizedError(..)); > return true; > } > > Thanks, > > -a > > -- > Aaron Stromas > Mobile: +1 703 203 9169 > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Stripes-users mailing list > Stripes-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/stripes-users > > ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users