struts1_MappingDispatchAction
2015-08-12 00:00
316 查看
摘要: MappingDispatchAction 这样就避免了写多个Action
下面是请求的html:
下面是struts-config.xml文件:
下面是请求的java文件:
下面是请求的html:
<html:link action="/addbook">添加图书</html:link> <html:link action="/deletebook">删除图书</html:link> <html:link action="/updatebook">修改图书</html:link> <html:link action="/findbook">查找图书</html:link>
下面是struts-config.xml文件:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"> <struts-config> <action-mappings> <action path="/addbook" type="cn.itcast.web.action.BookAction2" parameter="add"/> <action path="/updatebook" type="cn.itcast.web.action.BookAction2" parameter="update"/> <action path="/findbook" type="cn.itcast.web.action.BookAction2" parameter="find"/> <action path="/deletebook" type="cn.itcast.web.action.BookAction2" parameter="delete"/> </action-mappings> </struts-config>
下面是请求的java文件:
public class BookAction2 extends MappingDispatchAction { public ActionForward add(ActionMapping arg0, ActionForm arg1, HttpServletRequest arg2, HttpServletResponse arg3) throws Exception { System.out.println("add...."); return null; } public ActionForward update(ActionMapping arg0, ActionForm arg1, HttpServletRequest arg2, HttpServletResponse arg3) throws Exception { // TODO Auto-generated method stub System.out.println("udpate...."); return null; } public ActionForward delete(ActionMapping arg0, ActionForm arg1, HttpServletRequest arg2, HttpServletResponse arg3) throws Exception { // TODO Auto-generated method stub System.out.println("delete...."); return null; } public ActionForward find(ActionMapping arg0, ActionForm arg1, HttpServletRequest arg2, HttpServletResponse arg3) throws Exception { // TODO Auto-generated method stub System.out.println("find...."); return null; } }
相关文章推荐
- 千锋扣丁学堂 如何学习android高级编程
- Elasticsearch 的坑爹事——记录一次mapping field修改过程
- elasticsearch mapping
- android官方侧滑菜单DrawerLayout详解
- 魅族mx2启动app黑屏
- iOS 第三方登陆避免被APP STORE拒
- iOS 9应用开发教程之多行读写文本ios9文本视图
- iOS 9应用开发教程之使用开关滑块控件以及滚动部署视图
- Android获取数据库sqlite文件方法的命令(亲测无root手机上可行)
- iOS中制作可复用的框架Framework
- Android Studio中ButterKnife插件的安装与使用
- android 自定义Toast显示风格
- Android控件Editext、TextView属性详解
- android studio 新建module
- ios单元测试之GHUnit
- ios的单元测试OCUnit以及更新了之后的XCTestCase
- Android-报错总结之一:WebView加载本地JS
- iOS 内存管理总结
- Android Studio 工具栏切换卡顿
- 修改Android签名证书keystore的密码、别名alias以及别名密码