This is what I came up with:

<c:set var="foo" value="valueA"/>
<logic:messagesPresent name="org.apache.struts.action.ERROR" property="currentField">
<c:set var="foo" value="valueB"/>
</logic:messagesPresent>
. . . render the prompt for currentField, placing <c:out value="${foo}"/> where necessary (this could be a css class or font color, etc.) , , ,


I am doing this for each field. Please let me know if there is a better way.

Thanks,
Erik



Erik Weber wrote:

I see that the ActionErrors object is stored as a request attribute under the key "org.apache.struts.action.ERROR".

I would like to set a different CSS class for each <td> containing a field that has a property that is keyed in the ActionErrors instance. In pseudocode:

begin "username" field;
if (ActionErrors instance exists and ActionErrors instance contains any ActionErrors for the "username" property) {
open td with class set to "style B";
print prompt for username field;
print username field;
close td;
}
else {
open td with class set to "style A";
print prompt for username field;
print username field;
close td;
}


. . . and so on, for each field. This seemingly could get to be a lot of code. Any Struts/JSTL tag tricks I can use?


Thanks, Erik




Erik Weber wrote:

In a JSP containing a form, what is the easiest way to see if a form validation error message exists for a particular, say, html:text field, when that page is processing after form validation has failed? For example, what if you wanted to present the messages field by field instead of all together at the top of the page? I assume the error messages are keyed according to the value of the "property" attribute for each field, or something similar?

Thanks,
Erik

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



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



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



Reply via email to