I had sent this a query a while go, didn't get any responses. Now this is
proving to be a thorny problem so here it goes again.
Using html:messages or logic tags, is it possible to group the error
messages by each property which has errors attached to it and output a
header, 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, we 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.
I guess I am looking for something like
<for each property which has errors>
<get property name and output header for that property/>
<output messages for that property/>
</for>
Is this possible with the standard tags? Thanks in advance for any hints.
Cheers,
Krishna
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>