This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes loosing fielderror when result to another action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "loosing fielderror when result to another action" Watch "loosing fielderror when result to another action" New topic
Author

loosing fielderror when result to another action

J Young
Greenhorn

Joined: Feb 11, 2010
Posts: 4
Hi

I am unable to see a <s:fielderror/> on the view.jsp, even though I know the validator is populating it.



If I do the following, it works, but this is not what I want. I want to perform the processing inside of ViewAction:



Thanks,
James
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you redirect to a new action, it's a new instance, and the original action's properties are lost. You could consider using the store interceptor.
J Young
Greenhorn

Joined: Feb 11, 2010
Posts: 4
Unfortunately I'm trying not to use type="redirect-action", rather I want an include. (This is because of problems we have with handling redirects. Firewalls, etc..)

So everything is happening in the same request. I tried your suggestion. When I debugged the MessageStoreInterceptor, it went something like this:

MessageStoreInterceptor.before for EditAction -> do nothing
MessageStoreInterceptor.before for ViewAction -> try to retrieve error messages from session (they're not there yet)
MessageStoreInterceptor.after for ViewAction -> do nothing
MessageStoreInterceptor.after for EditAction -> try to store error messages to session (to late)

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: loosing fielderror when result to another action
 
Similar Threads
Struts 2 Problem
Can't enter in a jsp.
Struts2 Action Mapping Problem - No configuration found for the specified action
EditAction not called on liferay
Error while forwarding from struts.xml