public class UserAction extends ActionSupport {
public String del() {
return "del";
}
public String list() {
Map<String, Object> request = (Map<String, Object>) ActionContext.getContext().get("request");
request.put("uname", "华晨宇老婆");
return "list";
}
public String add() {
Map<String, Object> request = (Map<String, Object>) ActionContext.getContext().get("request");
Object uname = request.get("uname");
System.out.println(uname + "-------");
request.put("info", "算了吧");
return "add";
}
}
配置文件
<struts>
<constant name="struts.devMode" value="true"/>
<package name="day06" namespace="/" extends="struts-default">
<action name="userActionResult" class="cn.day06result.UserAction" method="list">
<result name="list" type="chain">
<param name="actionName">userActionResultAdd</param>
<param name="namespace">/</param>
</result>
</action>
<action name="userActionResultAdd" class="cn.day06result.UserAction">
<result name="add">/day06jsp/add.jsp</result>
</action>
</package>
</struts>