DispatchAction类一个Action中包含多个业务处理<测试通过>
2012-03-16 11:28
567 查看
前台页面:DispatchActionTest.jsp
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html:html>
<body>
<html:link href="userBank.do?method=saveMoney"><存钱</html:link>
<html:link href="userBank.do?method=getMoney">取钱</html:link>
<html:link href="userBank.do?method=findBalance">查询余额</html:link>
</body>
</html:html>
后台DispatchAction:
package com.login.struts.Action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
public class BankAction extends DispatchAction
{
public ActionForward saveMoney(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
return mapping.findForward("save");
}
public ActionForward getMoney(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
return mapping.findForward("get");
}
public ActionForward findBalance(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
return mapping.findForward("find");
}
}
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html:html>
<body>
<html:link href="userBank.do?method=saveMoney"><存钱</html:link>
<html:link href="userBank.do?method=getMoney">取钱</html:link>
<html:link href="userBank.do?method=findBalance">查询余额</html:link>
</body>
</html:html>
后台DispatchAction:
package com.login.struts.Action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
public class BankAction extends DispatchAction
{
public ActionForward saveMoney(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
return mapping.findForward("save");
}
public ActionForward getMoney(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
return mapping.findForward("get");
}
public ActionForward findBalance(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
return mapping.findForward("find");
}
}
相关文章推荐
- Struts2 一个form组成的action内包含多个请求的处理方式。通配符形式。
- Problem Description 有n(n<=100)个整数,已经按照从小到大顺序排列好,现在另外给一个整数x,请将该数插入到序列中,并使新的序列仍然有序。 Input 输入数据包含多个测试实例,每组数据由两行组成,第一行是n和m,第二行是已经有序的n个数的数列。n和m同时为0标示输入数
- Struts2一个Action内包含多个请求处理方法的处理,method的使用方法,struts2中的路径问题,通配符映射
- Struts2一个Action内包含多个请求处理方法的处理,method的使用方法,struts2中的路径问题,通配符映射
- 一个Action内包含多个请求处理方法的处理
- 一个Action内包含多个请求处理方法的处理
- Struts2一个Action内包含多个请求处理方法的处理
- Struts2一个Action内包含多个请求处理方法的处理,method的使用方法,struts2中的路径问题,通配符映射 (
- Struts2一个Action内包含多个请求处理方法的处理,method的使用方法,struts2中的路径问题,通配符映射
- 关于<<STL源码剖析>>中4.4.5节测试程序不能通过编译的说明
- 控件包含代码块(即 <% ... %>),因此无法修改控件集合异常处理
- 【ELK】自定义ES-5.4.1插件步骤2——带action-&amp;gt;transportaction分层结构并包含详细的集成测试步骤
- 续接上篇<Ovirt环境部署手册(barron测试通过)>
- 关于<action><result><package>的name和namespace属性同名时struts2的处理
- HTML 图片映射,一个图片映射多个链接<map>
- js正则:匹配一个html的tagname的开始标签,主要是解决包含&lt;&gt;(正则的效率问题建议不使用)
- Struts2一个action包含多个处理逻辑解决方法(动态方法调用)
- struts2:数据校验,通过Action中的validate()方法实现校验(续:多业务方法时的不同验证处理)
- 通过反射把list<T>转换成datatable,kill进程,事务传入一个Lst<String>多条sql语句
- Struts 中的一个action 包含多个请求