struts2chainstruts2-interceptorsvaluestackactioncontext

Actionmessages and actionerror values are set to null when a new action is called using "chain" result type


I am adding action messages as below

this.addActionMessage("alert:" + getText("message.display.Sucess"));
<action name="resetpass" method="resetpass" class="com.UserAction">
    <result type="chain">usersAdmin</result>
</action>

<action name="usersAdmin" method="usersAdmin" class="com.UserAction">
<result name="List">/jsp/templates/admin/user/UserAdmin.jsp
</result>

While using struts2 2.5.33, When I click on reset button, the alert is added successfully on web page, but when I upgarded to 6.3.0.2, the value of actionMessages is null. The value is not preserved when a new action is called.

I also read that When you're redirecting to another action using the "chain" result type in Struts 2, you need to be aware that the request and action context are recreated. Why didn't this issue come up in earlier struts version??

I had to explicitly add store interceptor ( STORE/RETRIVE and it was then able to preserve the value. I have added these validation errors in many areas and using store doesn't seem to be appropriate. Even request.setattribute("message",this.getActionMessages()) worked

Could you please help what can be the exact reason for this change and how to fix it?


Solution

  • struts.xwork.chaining.copyErrors is now updated to struts.chaining.copyErrors

    Changing this worked. Thankyou