This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android 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?
 
Similar Threads
addActionError in struts2
Iterating over HaspMap<String,List<Object>> and comparing values.
Loop in JSP with Struts
creating button using <s:button> - similar to the CSS based button
Accessing action errors in JSP