This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes How to iterate through action messages in struts2? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to iterate through action messages in struts2?" Watch "How to iterate through action messages in struts2?" New topic
Author

How to iterate through action messages in struts2?

Narendran Shanmugasundaram
Greenhorn

Joined: Jun 26, 2009
Posts: 8
Hello,

I am setting a few messages in my action class using

But I am not able to iterate through those messages. I could only print them using

This prints the messages as an unordered list. I do not want it to be displayed in that fashion. I want to do some custom formatting.

I am able to do some custom formatting for the action errors using the following:


I would like to be able to do something similar for action messages. Is that possible?

Thanks in advance,
Naren.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yes.
Narendran Shanmugasundaram
Greenhorn

Joined: Jun 26, 2009
Posts: 8
David,

Thanks for your reply. I tried this:


But it did not print anything. Whereas

prints a couple of messages.

Please let me know if I am doing something wrong in the first code snippet.

Thanks,
Naren
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Seems fine to me (except for the typo of hasActionMesssages()); I've used similar code.
Narendran Shanmugasundaram
Greenhorn

Joined: Jun 26, 2009
Posts: 8
David,

You were right. It did work when I removed the typo. I had been trying to get it to work for a couple of days. Thanks a lot for pointing it out.

Cheers,
Naren.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to iterate through action messages in struts2?