Struts2中从一个action内部跳转到另一个action中的指定方法(这个action中有很多方法),怎么配置xml呀?

Struts2中从一个action内部跳转到另一个action中的指定方法(这个action中有很多方法),怎么配置xml呀? 求各位帮助 麻烦了 虽然没有财富值 但是相信各位大神会伸出援助之手谢谢

<package name="action" extends="struts-default">
<action name="ac1_*" class="com.Action.Action1" method="{1}">
<result type="chain" name="ac2">ac2_method</result> <!--把这里的method替换为你第二个action中的方法名-->
</action>

<action name="ac2_*" class="com.Action.Action2" method="{1}">
<result>/index.jsp</result>
</action>
</package>追问

你这个也是对的谢啦哥们

温馨提示:内容为网友见解,仅供参考
第1个回答  2012-06-29
第一个action配置: execute 方法中,返回 return "other";

<action name = "myAction" class = "com.test.action.MyAction">
<result type = "redirectAction" name = "other">这里写另外一个action 的url路径,相对路径</result>

</action>
第二个 action 配置,
<action name = "otherAction" class = "com.test.action.OtherAction" method = "other">
<result name = "success">结果页面</result>

</action>追问

你好问下 method 指定方法名为other 那就是走otheraction中的一个other方法
这里吗redirectAtion 指的是otherAction对么?麻烦你了大神

追答

no,other 是 otheraction的一个方法是对的,redirectAtion 不是 第二个action ,我不写的很清楚吗。之间 是 另外一个 action 的 url。
比如说
otherAction.action
otherAction.action 这个 是 另外 一个 action,就像 你 表单提交时候 ,form action = "otherAction.action" 一样

追问

谢啦大神

本回答被提问者采纳
相似回答