aspose file tools*
The moose likes Struts and the fly likes html:messages ActionMessages Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:messages ActionMessages Action" Watch "html:messages ActionMessages Action" New topic
Author

html:messages ActionMessages Action

azhar bharat
Ranch Hand

Joined: Jul 17, 2006
Posts: 87
I have the following code in my Action:
ActionMessages messages=new ActionMessages();
messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("general.message",id));
forward=mapping.findForward("Success");
return forward;

And the below code in jsp file to which it is forwarded to:
<html:messages id="msg" message="true">
<bean:write name="msg" />
</html:messages>

But nothing is displayed.

The errors in my actionforms are properly displayed. The problem seems to be with messages from Action class.

What is wrong ?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Did you do the following in your Action class?

saveMessages(request, messages);

If not, that's the problem.


Merrill
Consultant, Sima Solutions
azhar bharat
Ranch Hand

Joined: Jul 17, 2006
Posts: 87
this worked fine
saveMessages(request.getSession(), messages);
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The saveMessages() method gives you the choice of putting your messages in either session scope or request scope.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:messages ActionMessages Action