Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:messages ActionMessages Action

 
azhar bharat
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you do the following in your Action class?

saveMessages(request, messages);

If not, that's the problem.
 
azhar bharat
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this worked fine
saveMessages(request.getSession(), messages);
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The saveMessages() method gives you the choice of putting your messages in either session scope or request scope.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic