Meaningless Drivel is fun!*
The moose likes Struts and the fly likes html:errors tag not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:errors tag not working" Watch "html:errors tag not working" New topic
Author

html:errors tag not working

Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
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...
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.
Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
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

Joined: Feb 05, 2003
Posts: 4727

Please post your form, action, and struts-config or at least the relevant portions of each.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:errors tag not working
 
Similar Threads
Can i Use my action to throw error
How to check if a particular error is present ?
ActionErrors (Struts)
validation error causes an URL problem!!
Limitations on use of html:errors