aspose file tools*
The moose likes Struts and the fly likes Struts Errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Errors" Watch "Struts Errors" New topic
Author

Struts Errors

Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
How to retrieve the saved errors in the action class. I know the saveErrors() set the errors in the request object, but I don't know what's the key to retrieve.


java.util.HashMap map = (java.util.HashMap)request.getAttribute("???");


Thanks a lot.
Venkat
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
First of all, the Object put in request scope by SaveErrors is not a HashMap, but an ActionMessages instance. Note that since ActionErrors is a subclass of ActionMessages, it could contain an instance of ActionErrors also.

The best way to retrieve and display it in your JSP is simply to use either the <html:errrors/> or <html:messages/> tag.

If you really want to retrieve it in a scriptlet, this is the code:

[ January 12, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
Great. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Errors