• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Errors

 
Venkat Babu
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Venkat Babu
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic