一 Action
1 FirstAction
package org.crazyit.app.action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ActionContext;
public class FirstAction extends ActionSupport
{
public String execute()
{
System.out.println("进入第一个Action");
addActionMessage("第一个Action的提示信息");
return "second";
}
}
2 FirstSecondAction
package org.crazyit.app.action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ActionContext;
public class FirstSecondAction extends ActionSupport
{
// 处理用户请求
public String execute()
{
System.out.println("进入第二个Action");
addActionMessage("第二个Action添加的提示信息");
return SUCCESS;
}
}
二 视图
index.jsp
<% response.sendRedirect("first"); %>
first-second-success.jsp
<%@ page contentType="text/html; charset=GBK" language="java" errorPage="" %>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>链式处理成功</title>
</head>
<body>
提示信息:<s:actionmessage/>
</body>
</html>
三 测试