You can do this....

1) create an ActionMessages object and populate it with the
ActionMessage you wish to show.

2) in the jsp include the following snippet:

<logic:messagesPresent message="true">
  <div class="message">
    <html:messages id="message" message="true">
      ${message}<br/>
    </html:messages>
  </div>
</logic:messagesPresent>

You can of course format that however you want.

Al


-----Original Message-----
From: Scott Purcell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 4:25 PM
To: user@struts.apache.org
Subject: Place message in jsp from action?

Hello,
 
After I complete a successful Action, and I forward to my jsp page, I
would like to display a status ... something like "New User Added".
 
Something that operates like the ActionErrors object. I tried doing this
in my Action class:
ActionErrors errors = new ActionErrors();
      // Get access to the message resources for this application
      // There's not an easy way to access the resources from an
ActionForm
      MessageResources resources =
        (MessageResources)request.getAttribute( Action.MESSAGES_KEY );
      // Check and see if the access number is missing
      ActionError newError = new
ActionError("global.error.database.problem");
      errors.add(ActionErrors.GLOBAL_ERROR, newError);
 
And then tried to pull the error out (just like an form error), but the
error never shows? 
<html:errors />
 
I figured I am missing something, or possibly there is a better way to
handle this?
 
Thanks,
Scott
 

. 
                                                 

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to