您的位置:首页 > 其它

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");
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐