Hi,
Errors don't survive the redirect. Only messages do.
One thing you can do is to save errors in context.getMessages("errors") and get
them back on the next request. This solutions may force you to create a
subclass of MessagesTag.
Another option is to save errors in flash scope and get them back on the next
request. That would look like flashScope.put("my_errors",
context.getvalidationErrors()); in current request and
context.getRequest().getAttribute("my_errors") on the redirect - you can also
use EL in a JSP here since it's an attribute.
Christian
-----Message d'origine-----
De : Evan Leonard [mailto:[email protected]]
Envoyé : October-07-10 6:39 PM
À : Stripes Users List
Objet : [Stripes-users] Rather basic question about flashScope and
ValidationErrors
Hi all,
I have a ActionBean that may receive a post from a source page other than
itself. Though, if validation fails i'd like to redirect back to this
ActionBean's default hanlder. What I've tried so far is to implement
ValidationErrorHandler and then add this method:
public Resolution handleValidationErrors(ValidationErrors errors) throws
Exception
{
return new RedirectResolution(getClass());
}
I've also tried this:
return new RedirectResolution(getClass()).flash(this);
>From what I've read, I thought that the errors would automatically be carried
>over to the next request via flash scope. I've done a little tracing and can
>see that they do get carried over, but then get wiped out in the next request
>in the method named AnnotatedClassActionResolver.setActionBeanContext
I'm certain I'm missing something basic here. Freddy's book makes it sound like
the errors will get carried over automatically, though that appears not be the
case.
What am I missing?
Thanks
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users