Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts 2 and messages !!

 
mudassir shahab
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
i have two methods in my action that are save and list and two jsps respectively . when user add new record it goes to save method where i am using addActionMessage("record added successfully") and goes to list method
to populate all record list and and show on list jsp ...
PROBLEM :
1- if i use type="redirect" attribute in action in struts.xml ,
<result name="success" type="redirect">listRecord.htm</result>
i think it generates new request because of which it is not showing message set in addActionMessage method , when it goes to list jsp through the list method..
2- when i change the result type to type="chain"
<result name="success" type="chain">listRecord</result>
it shows the message on list jsp but another problem occured ....since it does not nullify the request in this case , the action set in request which is like this "action:save" creates problem. when i click sortable option of display tag , rather than going to list method it goes to the save method , thus throwing exception (in my case) because of duplicate record ...
....................... any solution ???
 
Steve Wooten
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe what you are looking for is this
<result type="chain">
<param name="actionName">login_*</param>
<param name="method">input</param>
</result>
You can find the doc here

http://struts.apache.org/2.x/docs/chain-result.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic