问题描述
我使用的是最新的 struts 2.3.12 版本.
I am using latest struts 2.3.12 version.
我的struts.xml
<action name="*ContractorDetail" class="waid.config.contractor.ContractorDetailAction" method="{1}">
<result name="ContractorDetailScreen" type="tiles">ShowContractorDetailScreen</result>
<result type="chain" name="success">
<param name="actionName">ContractorSummary</param>
<param name="namespace">/app</param>
</result>
<result name="input" type="redirectAction">
<param name="actionName">ContractorSummary</param>
<param name="namespace">/app</param>
</result>
<result name="error" type="redirectAction">
<param name="actionName">ContractorSummary</param>
<param name="namespace">/app</param>
</result>
<result name="deleteDependency" type="chain">
<param name="actionName">ContractorSummary</param>
<param name="namespace">/app</param>
</result>
</action>
<action name="*ContractorSubmit" class="waid.config.contractor.ContractorSubmitAction" method="{1}">
<result type="chain" name="success">
<param name="actionName">modifyContractorDetail</param>
<param name="namespace">/app</param>
</result>
<result name="error" type="tiles">ShowContractorDetailScreen</result>
<result name="input" type="tiles">ShowContractorDetailScreen</result>
</action>
在我的提交操作中,我正在设置 actionMessage 和 action errorMessage,它们将转发到 detailsAction.在以前版本的 struts(2.1) 中,动作消息显示在 jsp 中.但是升级到 struts 2.3.12 版本后,jsp 中都没有出现 action 消息和 action 错误.
In my Submit action i am setting actionMessage and action errorMessage which will forwarded to detailsAction.In previous version of struts(2.1) action message are showing in jsp.But after upgrading to struts 2.3.12 version action message and action error both are not coming in jsp.
推荐答案
尝试在 struts.xml 中添加这些行以恢复原始行为
Try add these lines in struts.xml to restore the original behaviour
<constant name="struts.xwork.chaining.copyErrors" value="true"/>
<constant name="struts.xwork.chaining.copyFieldErrors" value="true"/>
<constant name="struts.xwork.chaining.copyMessages" value="true"/>
我从这里得到了解决方案:http://struts.apache.org/release/2.3.x/docs/chaining-interceptor.html
I took the solution from here:http://struts.apache.org/release/2.3.x/docs/chaining-interceptor.html
这篇关于动作消息和动作错误未转发到struts2.3.12中的不同动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!