欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

struts-DispatchAction

程序员文章站 2022-05-08 18:05:36
...
同一个Action 类来处理几个相关的任务。一个很好的例子是对一个数据记录执行基本的CRUD (创建读写修改删除)数据操作

public class book extends DispatchAction{
public ActionForward Create(ActionMapping mapping,ActionForm form,HttpServletRequest Request,HttpServletResponse Response)
throws IOException,ServletException{
.......
}
public ActionForward read(ActionMapping mapping,ActionForm form,HttpServletRequest Request,HttpServletResponse Response)
throws IOException, ServletException{
.......
}

public ActionForward update(ActionMapping mapping,ActionForm form,HttpServletRequest Request,HttpServletResponse Response)
throws IOException, ServletException{
.......
}

public ActionForward delete(ActionMapping mapping,ActionForm form,HttpServletRequest Request,HttpServletResponse Response)
throws IOException, ServletException{
.......
}

//其他方法
}


在配置文件中:

<action path="/book" type="app.recordDispatchAction" name="dataForm" scope="request" input="/index.jsp" parameter="method"/>

访问路径:
uri?method="方法名"
相关标签: Struts BBS