Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying actionmessages on the same page in Struts2

 
Anil Verghese
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do we display actionmessages/actionerrors on the same page in Struts2? Kind of urgent...
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<result name="input">inputjsppage.jsp</result>
If you want to display the action error messages you should "input" in result. The default return is "input" there is any error in the action class.
 
Anil Verghese
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Struts 2... and everytime a message has to be shown i insert the message into addActionMessage(); I have included a <s:actionmessage/> in my jsp but due to some reason everytime the message has to be dis[played the same page gets reloaded but with the message. The issue here is instead of a single page i get the same page twice one loaded over the other?
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Redirecting to the same action / jsp and including the



in the code after the validation should do the job, but you say it doesn't so paste your code here... 'action' class, struts.xml, web.xml, jsp.. etc... lets see what you have...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic