Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to iterate through action messages in struts2?

 
Narendran Shanmugasundaram
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Narendran Shanmugasundaram
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems fine to me (except for the typo of hasActionMesssages()); I've used similar code.
 
Narendran Shanmugasundaram
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic