shot in the dark(haven's used this before):
could it be because validation errors are still present..?
what happens when you try:
*
public* Resolution handleValidationErrors(ValidationErrors errors)
*throws* Exception {
String event = getContext().getEventName(); // First
validation error is triggered in the event “persistUserData”
*if* (!event.equals("execute")) {
/*getContext().getValidationErrors().clear();
*/
*return* *new*
ForwardResolution(EditUserAction.*class*,
"execute").addParameter("user.id", user.getId());
} *else* {
*return* *null*;
}
}
On 12/22/2008 12:59 PM, Héctor López wrote:
Thanks for the reply.
My error was to believe that handleValidationErrors was called “when
validation fails”, when, in fact, the method is called “whenever there
are ValidationErrors in the actionbeancontext” (as clearly stated in
the javadoc, btw). This can seem the same at first sight, but there’s
a rough corner. If you try to forward to **the same** action but
different event, handleValidationErrors will be invoked again,
possibly resulting in an infinite loop.
On a side note, while testing my discoveries, I’ve found that the
event gets lost when a forward is made to the same action… Don’t know
if this is a known issue. Rudimentary sample code:
*public* Resolution handleValidationErrors(ValidationErrors errors)
*throws* Exception {
String event = getContext().getEventName(); // First
validation error is triggered in the event “persistUserData”
*if* (!event.equals("execute")) {
*return* *new*
ForwardResolution(EditUserAction.*class*,
"execute").addParameter("user.id", user.getId()); // Execute
event gets ignored, resulting in an infinite loop
} *else* {
*return* *null*;
}
}
Sorry about the clumsy explanation.
Thanks.
------------------------------------------------------------------------
*De:* marijan milicevic [mailto:mari...@info.nl]
*Enviado el:* lunes, 22 de diciembre de 2008 11:50
*Para:* Stripes Users List
*Asunto:* Re: [Stripes-users] Method handleValidationErrors and Wiki...
Hi Hector,
I am not a writer of this entry but I believe it means method will be
invoked when validation not passes (fails).
So, lets say you have a form that contains some validation errors,
normally,
user will be presented with your form and validation errors.
However, if you implement ValidationerrorHandler intrerface, before
presenting user with the form,
method handleValidationErrors() will be invoked,
and there you can decide what to do with errors (e.g. remove them, add
more errors etc)
hth,
-m
On 12/22/2008 11:32 AM, Héctor López wrote:
Hi all.
Just noticed (after scratching my head for a couple hours) that I had
misunderstood the statement “is invoked when validation fails” in the
Validation Reference wiki. Can I have a wiki user to try to clarify it?
User: hlopf
Mail: hector.lo...@unileon.es <mailto:hector.lo...@unileon.es>
Thanks.
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users