File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

how control use of errors.footer and errors.header

Lance Hill

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

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

Joined: Feb 26, 2001
Posts: 6529

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]
I agree. Here's the link:
subject: how control use of errors.footer and errors.header
It's not a secret anymore!