Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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

how control use of errors.footer and errors.header

 
Lance Hill
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there some way to control the use of the errors.header and errors.footer elements when using the html:errors tag?

I have both validation and runtime exceptions and would like to format them differently. In the case where I am rendering runtime exceptions, I do not want to use ul and li to display them as there will likely only be one error to display. I apologize if this question has been asked and answered a few times already, but I only find posts on how to show the error within the header and footer.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It might be smart to place runtime exceptions somewhere other than the ActionErrors. You could always place them in request scope and retrieve them from the jsp that way and format them however you want.
 
Junilu Lacar
Bartender
Posts: 7466
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Referring to the latest taglib API documentation, Since Struts 1.2.5, the html:errors tag has the attributes header, footer, prefix, and suffix that allow you to control the rendering of error messages. I personally prefer having the formatting tags in the JSP instead of the resource file so I use html:messages instead, which gives me far greater control over how messages are rendered.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic