Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:errors tag not working

 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Environment: struts-1.1, jboss3.2.3 with embedded tomcat.
My ActionClass saves errors and returns. However, the display page that has the <html:errors/> tag does not display anything. After digging deeper I see that the Errors saved in the Action class using saveErrors(request, errors) are lost, ie., errors stored in HttpServletRequest are lost by the time it reaches the jsp. Debugging further, I see that down in the Struts RequestProcessor, in the doForward() method, the errors are still present. Then when the RequestDispatcher dispatches the request, the errors are not present as found in the tag. I noticed, that if I place the errors in the session, that seems to work. However, i dont want to keep these errors in the session.
Why are my errors being cleared out when all I am doing is a forward and not a redirect? Thanks for your assistance in advance.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm making a wild guess but it sounds like you are calling a forward from a jsp??? I don't know why else you would have mentioned "redirect":
Why are my errors being cleared out when all I am doing is a forward and not a redirect?

If that is the case, realize that the jsp's forward is treated as a separate request from the user's browser. Use the struts-config for defining forwards and it will all be done in the same request.
If my assumption is completely wrong, my apologies. Rephrase your problem and I'll take another crack at it.
 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your assistance. I am using the word redirect as I am losing the parameters in the HttpServletRequest, something that would not happen I imagine with a forward.
I detail, from Struts request Processor:

If I try to get my Error attribute before the rd.forward(request, response), the attributes are there.
However, when it gets to my error.jsp that has the <html:errors> tag there is no values for the key. I am printing out the contents in the Error tag itself but to no luck. Thanks.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post your form, action, and struts-config or at least the relevant portions of each.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic