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

Reply via email to