This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes how control use of errors.footer and errors.header 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 "how control use of errors.footer and errors.header" Watch "how control use of errors.footer and errors.header" New topic
Author

how control use of errors.footer and errors.header

Lance Hill
Greenhorn

Joined: Oct 13, 2004
Posts: 14
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

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4447
    
    5

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.



Junilu - [How to Ask Questions] [How to Answer Questions]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how control use of errors.footer and errors.header
 
Similar Threads
How to put carriage return in MessageResource.properties?
html:errors how to show different headers and footers
the struts html:errors tag upset me
Accessing ActionErrors in JSP
Using ActionMessages to display Errors using errors.headers and errors.footers