Thanks for all the help received on this one.. As pointed out by Joe, the <html:messages> tag is conditional, and when supplying the "parameter" atribute I get exactly what I need.
For reference, it looks like this: <%-- Display error message keyed under 'usernameError' if it exists --%> <html:messages id="error" property="usernameError"> <tr> <td></td> <td>${error}</td> </tr> </html:messages> Thanks again all! -----Original Message----- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: 05 October 2004 14:00 To: Struts Users Mailing List Subject: RE: ActionError and JSP display At 1:45 PM +0100 10/5/04, Robin Mannering wrote: >Hi, > > >I was intending to use <html:errors property="username"/>, >specifying the property for display, but it still doesn't allow me >to test for it's existence. > > >What I'd like to do is test if an error exists, then add a new HTML >table row and cell into the output containing the error message, >otherwise I do not want to create the HTML table row and cell at all. > >Is there a way to do this ? Personally, I think <html:errors> is "the old way", although at least one committer has expressed a preference for it. I prefer <html:messages> It is essentially a combination conditional block and iterator. Here is my "standard" error messages JSP block: <html:messages id="msg"><div class="error"><c:out value="${msg}" /></div></html:messages> By default, it looks for an ActionMessages object saved using Struts' "saveErrors" semantics (that is, stored in the request under "org.apache.struts.action.ERROR" You can set the "message" attribute to "true" to get "messages" instead, and you can set the "name" attribute to fetch any arbitrary ActionMessages. Furthermore, you can use the "property" attribute to constrain the condition to only if the ActionMessages contains messages for the given property. If you're not using the JSTL, you can use <bean:write> instead of <c:out> to display the message itself. And, of course, you can use table rows instead of divs to wrap each message provided by the iterator. http://struts.apache.org/userGuide/struts-html.html#messages Hope this helps... Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll know I'm in the wrong place." - Carlos Santana ==================================================================== This e-mail and any attachments may be confidential and/or legally privileged. If you have received this e-mail and you are not a named addressee, please inform Landmark Information Group on 01491 413030 and then delete the e-mail from your system. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail. This email and any attachments have been scanned for viruses and to the best of our knowledge are clean. To ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our servers. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]