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.
Never be satisfied with anything less than the best and you will surely pass the test...
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.
A good workman is known by his tools.
Joined: Jan 15, 2002
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.