struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From otisg <ot...@ureach.com>
Subject Re: ActionMessage(s) + html:messages
Date Mon, 01 Dec 2003 15:47:29 GMT
Hello,

I still haven't resolved the problem described in the original
email, so here is some sample code that should illustrate the
problem with ActionMessage(s) and html:message tags futher.

The code that uses ActionError(s) works when used with
html:messages tag.
The code that uses ActionMessage(s) does _not_ work with
html:messages tag, even though it looks like it should be
equivalent to the lines that use ActionError(s).

  // ActionErrors errors = new ActionErrors();
  ActionMessages errors = new ActionMessages();
  // errors.add(ActionErrors.GLOBAL_ERROR,
             new ActionError("error.auth.failure"));
  errors.add(ActionMessages.GLOBAL_MESSAGE,
           new ActionMessage("error.auth.failure"));
  // saveErrors(request, errors);
  saveMessages(request, errors);
  return mapping.findForward("failure");


I am using html:messages like this:

          <html:messages id="msg">
            <c:out value="${msg}"/>
          </html:messages>


The above JSP snippet works fine with ActionError(s) code above,
but _not_ with ActionMessage(s) code, which is also above.

Am I doing something wrong here?

Thanks,
Otis



________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


---- On Fri, 28 Nov 2003, otisg (otisg@ureach.com) wrote:

> Hello,
> 
> I am trying to use ActioMessage(s) + html:messages to display
> error and non-error messages in the UI.
> 
> However, my html:message tag is showing only messages set by
the
> validator, and not the messages that I am trying to set
inside
> an Action, like so:
> 
>   ActionMessages errors = new ActionMessages();
>   errors.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionMessage("error.auth.failure"));
>   saveMessages(request, errors);
>   return mapping.findForward("failure");
> 
> In the JSP layer I use html:messages like this:
> 
>       <logic:messagesPresent>
>         <html:messages id="error">
>           <c:out value="${error}"/>
>         </html:messages>
>       </logic:messagesPresent>
> 
> Am I using these two things incorrectly?
> 
> Any help will be appreciated.  I found example usage of
> html:messages in a few Struts-related web pages, but none
> described how it works when you set ActionMessage(s) in an
> Action class.
> 
> Thank you,
> Otis
> 
> 
> 
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
struts-user-help@jakarta.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message