• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

html:errors tag not working

 
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post your form, action, and struts-config or at least the relevant portions of each.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic