struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Campbell <mike.campb...@s1.com>
Subject RE: question on errors, how to handle
Date Thu, 01 Feb 2001 17:35:22 GMT
Perfect Craig, thanks.  I suspected there was something like this.

> When you store an error in the ActionErrors collection, you have the
> option to associate it with a particular field:
> 
>     ActionErrors errors = new ActionErrors();
>     String username = formBean.getUsername();
>     String password = formBean.getPassword();
>     if ((username == null) || (username.length() < 1)
>         errors.add(new ActionError("username",
>             "error.username.required"));
>     ... and so on ...
> 
> Although the example app does not do so, you can utilize a recently
> added feature of the <html:errors> tag to place the messages where you
> want:
> 
>     ... prompt and field for the "username" field ...
>     <html:errors property="username"/>
> 
>     ... prompt and field for the "password" field ...
>     <html:errors property="password"/>
> 
> Craig McClanahan
> 
> 

Mime
View raw message