Title: RE: question on errors, how to handle

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
>
>

Reply via email to