Two Laptop Bag*
The moose likes Struts and the fly likes Not able to fetch the Action Error object 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 "Not able to fetch the Action Error object" Watch "Not able to fetch the Action Error object" New topic
Author

Not able to fetch the Action Error object

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All

I have a scenario where in there is a struts Action (ActionB) which is a sub class of (ActionA).
ActionA is not under our control & we cannot change any code there.

The flow is something like this ActionB's execute method indirectly calls ActionA's execute & in case of error scenarios the ActionError object get constructed & populated in ActionA's execute method.

I want to retreive this ActionError object in ActionB. But I am not able to fetch the same in ActionB.
But say if call ActionA individually I can get the ActionError object in its corresponding JSP.

How can i fetch the ActionError object in such a scenario


Regards
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If ActionA's execute method calls the saveErrors() method, the ActionErrors object will be in request scope. So, if you need to access it in ActionB, you can get it from the request. Here's an example:

If you're using version 1.1:


If you're using version 1.2:

[ August 02, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
Consider Paul's rocket mass heater.
 
subject: Not able to fetch the Action Error object
 
Similar Threads
Action Chaning & action Form reset problem
Thoughts on chaining Actions
Implement Flash Scope to Struts 2 App
Getting values from properties in validate-using multiple message-resources in struts
JSP Dynamically generated link needs to be associated with different form and submitted