重定向需要在struts.xml中配置redirectAction
action需要有个全局变量或实体,并且需要有setter/getter
如:
1.action:
2.struts.xml配置文件
黑色头发:http://heisetoufa.iteye.com
action需要有个全局变量或实体,并且需要有setter/getter
如:
1.action:
package com.test.action;
public class TestAction extends BaseAction implements Preparable {
Test test = new Test();
public String test() throws Exception {
test.setId(111111111);
return "toNextTest";
}
public Test getTest() {
return test;
}
public void setTest(Test test) {
this.test = test;
}
}
2.struts.xml配置文件
<action name="memberLogin" class="userAction" method="login">
<result type="redirectAction" name="toNextTest">toNextTest?test.id=${test.id}</result>
</action>
黑色头发:http://heisetoufa.iteye.com