I would write a tag as this is quite a customized need.  Just download
the source and you should have no problem building this functionality.

Edgar

-----Original Message-----
From: Krishnakumar N [mailto:[EMAIL PROTECTED]] 
Sent: Monday, November 18, 2002 4:53 AM
To: 'Struts Users Mailing List (E-mail)'
Subject: To produce html:messages grouped by properties in error


Using html:messages or logic tags, is it possible to output a header for
each property which has errors attached to it, without explicitly coding
a html:messages block for each property?

I have a form which has several fields, which are validated in the
Action class. These errors are added to the ActionErrors collection with
the field's property name, for example, 
errors.add("myFirstField", new Action Error(...);

Now, in the jsp, it is possible to produce an output such as 

Errors for My First Field
<error1 text>
<error2 text>

Errors for My Third Field
<error1 text>

I would like to do this without repeating a 
<logic:messagesPresent property = "myFirstField">
 <bean:message key="myfirstfield.error.header" />  <html:messages
id="error" property="myFirstField">
  <bean:write name="error" />
 </html:messages>
</logic:messagesPresent>

block for each property in the form as (a) this would be error prone,
programmers may miss to put this block for all the properties in the
form and (b) if this can be done without reference to specific form's
properties, then this generic code can be pulled into each page via some
kind of include or template mechanism.

Thanks in advance for any hints.



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to