struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Sinclair <alan.sincl...@earthlink.net>
Subject Re[2]: Displaying errors messages from validate in V1.2.4
Date Sat, 18 Dec 2004 18:40:20 GMT
Thanks for the tip. I did finally discover the message resource was
missing and the cause of the the excption in the JSP tag.

Thanks for the assistance.


> Your ActionMessage should contain the key to a message in some message
> resources, rather than the actual message itself. Something like...

>     errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage(
> "user.required" ) );

> then define "user.required=User name is null" in your message resources.

> Niall

> ----- Original Message ----- 
> From: <alan.sinclair@earthlink.net>
> To: <user@struts.apache.org>
> Sent: Friday, December 17, 2004 8:47 PM
> Subject: Displaying errors messages from validate in V1.2.4


>> Hi,
>> I cannt find the correct setup for <html:messages> to display error
> messages from a form's validate method in Struts 1.2.4
>>
>> For example, if I have something like this in the validate method:
>>
>> <snip>
>> public ActionErrors validate(ActionMapping mapping,
>>                    HttpServletRequest request) {
>>        ActionErrors errors = new ActionErrors();
>>
>>     if (username == null) {
>>        errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage( "User
> name is null" ) );
>>
>>     return errors;
>> </snip>
>>
>> What is the correct struts tag to use to display the error message ?  Are
> the java docs accurate?
>>
>> Best regards,
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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