Thanks Hubert, 

That has me going in the right direction, however only the <hr> element
is printing at the top of the page now. The message elements aren't
getting printed as they should. Can anybody spot the problem, I cant

Thanks,
Ciaran


-----Original Message-----
From: Hubert Rabago [mailto:[EMAIL PROTECTED] 
Sent: 09 January 2004 16:56
To: Struts Users Mailing List
Subject: Re: Problem displaying ActionMessages in JSP

try calling saveMessages(request,messages) in your action class.

--- Ciaran Hanley <[EMAIL PROTECTED]> wrote:
> Hello 
> Can anybody help me? I am trying to display messages on my JSP based
on
> whether an insertion to the DB was successful or not.
>  
> Properties file:
>  
> dbsuccess.add = Database Success: Details Added
> dberror.add = Database Error: Unable To Add Details At This Time
>  
>  
>  
> Action Class:
>  
> /* create ActionErrors instance to hold success/failure messages */
> ActionMessages messages = new ActionMessages();
>             
> try
> {
> ......business logic
>  
>       messages.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionMessage("dbsuccess.add"));
> setSession(messages, request);
> } 
> catch (Exception e) 
> {
>       messages.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionMessage("dberror.add""));
> setSession(messages, request);
> }
>  
>  
> private void setSession(ActionMessages messages, HttpServletRequest
> request)
> {
>       /* put the messages in the session */
>
request.getSession().getServletContext().setAttribute("messages",
> messages);
> }
>  
>  
> JSP file:
>  
> <logic:messagesPresent message="true">
>   <font color="red"><UL>
>     <html:messages id="messages">
>       <LI>
>         <bean:write name="messages" />
>       </LI>
>     </html:messages>
>   </UL></font><hr>
> </logic:messagesPresent>
>  
> Nothing is being printed at the top of the page, the insertion into
the
> database works fine but I cant get the success message up. Does
anybody
> know why this is happening?
>  
> Thanks,
> Ciaran
> 


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

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