Java Struts在执行动作完成后调用另一个动作
问题描述:
我正在使用Java和Struts2. 在我的struts.xml配置文件中,我具有打击配置.
I'm using Java and Struts2. In my struts.xml configure file i have blow config.
<action name="copyTestSuite" class="testSuiteAction"
method="copyTestSuite">
<result name="success">/WEB-INF/jsp/FormSuccessfulWithOutCloseWindow.jsp
</result>
</action>
执行动作copyTestSuite后,默认页面将转到FormSuccessfulWithOutCloseWindow.jsp.并且此页面仅用于重定向到上一页.
After i executed action copyTestSuite, the default page will go to FormSuccessfulWithOutCloseWindow.jsp. and this page is just used to redirect to previous page.
但是我想让它直接进入另一个与操作匹配的页面.我该怎么办?
But i want to let it go to another action matched page directly. How can i do this?
以下是我要重定向到的UpdateTestSuite的另一项操作:
Below is another action toUpdateTestSuite i want to redirect to:
<action name="toUpdateTestSuite" class="testSuiteAction"
method="toUpdateTestSuite">
<result name="success">/WEB-INF/jsp/testsuite/updateTestSuite.jsp
</result>
</action>
答
您可以使用此<result type="redirectAction"></result>
<action name="copyTestSuite" class="testSuiteAction"
method="copyTestSuite">
<result type="redirectAction">/newAction.action</result>
</action>