I have been using just what you have described via the following:
   <html:messages id="msg" message="false">
      <bean:write name="msg" />
   </html:messages>

However, the JSP fails with "Cannot find bean msg in any scope" when it tries 
to process the error message(s).




-----Original Message-----
From: Jim Barrows <[EMAIL PROTECTED]>
Sent: Dec 17, 2004 1:04 PM
To: Struts Users Mailing List <[EMAIL PROTECTED]>, 
        [EMAIL PROTECTED]
Subject: RE: Displaying errors messages from validate in V1.2.4



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 17, 2004 1:47 PM
> To: [EMAIL PROTECTED]
> 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?

<html:messages is the tag.
with option message=false because " By default the tag will retrieve the bean 
it will iterate over from the Globals.ERROR_KEY constant string, but if this 
attribute is set to 'true' the bean will be retrieved from the 
Globals.MESSAGE_KEY  constant string. Also if this is set to 'true', any value 
assigned to the name attribute will be ignored. [RT Expr]"


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