1、index.jsp
<body>
向结果传参数
<ol>
<li><a href="user/user?type=1">传参数</li>
</ol>
</body>
2.struts.xml
<struts>
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/user" extends="struts-default">
<action name="user" class="com.wxh.action.UserAction">
<result type="redirect">/userSuccess.jsp?t=${type}</result>
</action>
</package>
</struts>
3.UserAction.java
package com.wxh.action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
private int type;
public String execute() throws Exception{
return "success";
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
4、userSuccess.jsp
<body>
user Success!
<s:property value="r"/><br>
<s:property value="#parameters.t"/>
<s:debug></s:debug>
</body>