struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Weber <erikwe...@mindspring.com>
Subject Re: Retrieving specific form validation error messages
Date Thu, 29 Jul 2004 08:26:14 GMT
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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message