<a href="hello?name=1">重定向传参数</a>
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="hello"></default-action-ref>
<action name="hello" class="UserAction">
<result type="redirect">/index2.jsp?t=${name}</result>
</action>
</package>
public class UserAction extends ActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
@Override
public String execute() throws Exception {
System.out.println(name);
return ActionSupport.SUCCESS;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
<s:property value="#parameters.t"/>