It's not a secret anymore!
The moose likes Struts and the fly likes struts 2 and messages !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 2 and messages !!" Watch "struts 2 and messages !!" New topic

struts 2 and messages !!

mudassir shahab
Ranch Hand

Joined: Oct 13, 2003
Posts: 54
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 ...
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

Joined: Mar 20, 2007
Posts: 2
I believe what you are looking for is this
<result type="chain">
<param name="actionName">login_*</param>
<param name="method">input</param>
You can find the doc here
I agree. Here's the link:
subject: struts 2 and messages !!
It's not a secret anymore!