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: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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: [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