Tom,

you may want to try with the following:

  <table>
  <logic:messagesPresent message="true">
  <tr>
    <html:messages id="message" message="true">
    <td><bean:write name="message"/></td>
    </html:messages>
  </tr>
  </logic:messagesPresent>
  </table>

Please note the message="true" attribute in html:messages. Without that, the
tag looks for ActionErrors (under a different key) and not ActionMessages.

HTH

Andrej
> -----Original Message-----
> From: T. Wheeler [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 12, 2001 2:37 PM
> To: [EMAIL PROTECTED]
> Subject: Proper use of ActionMessages and <html:messages/> ?
> 
> 
> My application requires that I display status messages after 
> successfully
> performing some action (like, "You have successfully updated 
> the record"). 
> I was previously doing this in a very inelegant way, but it seems like
> ActionMessages are a better approach. 
> 
> However, since they are relatively new, I can't find any good 
> examples for
> using them.  They don't seem to be working with the 
> <html:messages/> tag as
> expected.
> 
> For example, I have an ActionClass named HomeAction that 
> forwards on success
> to index.jsp (the mapping for which is index.do).  In 
> HomeAction.java, I
> have this code:
> 
>    System.out.println("Preparing to add the message");
>    ActionMessages actionMessages = new ActionMessages();
>    
>    actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionMessage("my.key"));
>    
>    saveMessages(request, actionMessages);
>    System.out.println("Message had been added");
> 
> In index.jsp, I have this code:
> 
>       <html:messages id="messageid">
>               Message: <bean:write name="messageid">
>       </html:messages>
> 
> When I check the STDOUT logfile after requesting /index.do, I 
> see that the
> "Preparing to add the message" and "Message has been added" statements
> appear -- so the code is being called.  However, no message 
> shows up on the
> Web page (where the html:messages tag is).
> 
> Does anyone know what I am doing wrong?
> 
> Thanks!
> 
> Tom
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

Reply via email to