struts2-redirect和redirect-action的一点区别
Java代码
<action name="undoBdChannelOperator" class="bdChannelAction"
method="undoBdChannelOperator">
<result name="success" type="redirect">getUndoBdChannelListUI.action?operType=${operType} </result>
</action>
<action name="undoBdChannelOperator" class="bdChannelAction"
method="undoBdChannelOperator">
<result name="success" type="redirect">getUndoBdChannelListUI.action?operType=${operType} </result>
</action>
可以正常传递参数,而redirect-action不可以
但是可以写出如下形式
Java代码
<!-- 撤销对本地栏目的操作 -->
<action name="undoBdChannelOperator" class="bdChannelAction"
method="undoBdChannelOperator">
<result name="success" type="redirect-action">
<param name="actionName">
getUndoBdChannelListUI.action
</param>
<param name="operType">${operType}</param>
<param name="superCode">${superCode}</param>
<param name="webappCode">${webappCode}</param>
</result>
</action>
<!-- 撤销对本地栏目的操作 -->
<action name="undoBdChannelOperator" class="bdChannelAction"
method="undoBdChannelOperator">
<result name="success" type="redirect-action">
<param name="actionName">
getUndoBdChannelListUI.action
</param>
<param name="operType">${operType}</param>
<param name="superCode">${superCode}</param>
<param name="webappCode">${webappCode}</param>
</result>
</action>
另外:type="redirect" 的值可以转到其它命名空间下的action,而redirect-action只能转到同一命名空下的 action,因此它可以省略.action的后缀直接写action的名称。
struts2-redirect和redirect-action的一点区别
最新推荐文章于 2019-01-10 19:51:01 发布