This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts Errors  RSS feed

 
Venkat Babu
Ranch Hand
Posts: 47
  • 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
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. Thanks.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!