- 浏览: 693258 次
- 来自: ...
文章分类
最新评论
-
ranguisheng:
可以加点注释,代码不便于阅读.
用java实现数据库连接池的一个简单示例 -
abcd880129:
这样写的话,还要用专门的下载工具,不然,只能下到一个为空的ex ...
ZK下载文件时,不在服务器生成文件直接下载 -
234369425:
同上,是20
java计算阶乘 -
CodeToMyLaw:
如果目录中含有中文呢?
[^\x00-\xff] 中文的 ...
js验证文件目录格式的正确性 -
yanzhoupuzhang:
加了,还是报那个错误!
org.apache.commons.dbcp.BasicDataSource的解决方法
struts中的DispatchAction、LookupDispatchAction、Mappin
- 博客分类:
- struts 1.x
转载:http://hi.baidu.com/javajavajava/blog
index.jsp <%@ page language="java" pageEncoding="GB18030"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html lang="true"> <head> <html:base /> <title>index.jsp</title> </head> <body> DispatchAction <ul> <li><html:link page="/testDispatch.do?method=a">testDispatch a</html:link></li> <li><html:link page="/testDispatch.do?method=b">testDispatch b</html:link></li> <li><html:link page="/testDispatch.do?method=c">testDispatch c</html:link></li> </ul> LookupDispatchAction <ul> <li> <html:form action="/testLookupDispatch.do"> <html:submit property="cmd"><bean:message key="button.a"/></html:submit> <html:submit property="cmd"><bean:message key="button.b"/></html:submit> </html:form> </li> </ul> MappingDispatchAction <ul> <li><html:link page="/a.do">MappingDispatchAction a</html:link></li> <li><html:link page="/b.do">MappingDispatchAction b</html:link></li> </ul> </body> </html:html> struts-config.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <data-sources /> <form-beans > <form-bean name="testDispatchForm" type="com.hqh.struts.form.TestDispatchForm" /> <form-bean name="testLookupDispatchForm" type="com.hqh.struts.form.TestLookupDispatchForm" /> <form-bean name="testMappingDispatchForm" type="com.hqh.struts.form.TestMappingDispatchForm" /> </form-beans> <global-exceptions /> <global-forwards /> <action-mappings > <action attribute="testDispatchForm" input="/index.jsp" name="testDispatchForm" parameter="method" path="/testDispatch" scope="request" type="com.hqh.struts.action.TestDispatchAction" /> <action attribute="testLookupDispatchForm" input="/index.jsp" name="testLookupDispatchForm" parameter="cmd" path="/testLookupDispatch" scope="request" type="com.hqh.struts.action.TestLookupDispatchAction" /> <action attribute="testMappingDispatchForm" input="/index.jsp" name="testMappingDispatchForm" parameter="a" path="/a" scope="request" type="com.hqh.struts.action.TestMappingDispatchAction" /> <action attribute="testMappingDispatchForm" input="/index.jsp" name="testMappingDispatchForm" parameter="b" path="/b" scope="request" type="com.hqh.struts.action.TestMappingDispatchAction" /> </action-mappings> <message-resources parameter="com.hqh.struts.ApplicationResources" /> </struts-config> TestDispatchAction.java /* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.hqh.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; import com.hqh.struts.form.TestDispatchForm; /** * MyEclipse Struts * Creation date: 09-30-2007 * * XDoclet definition: * @struts.action path="/testDispatch" name="testDispatchForm" input="/form/testDispatch.jsp" parameter="method" scope="request" validate="true" */ public class TestDispatchAction extends DispatchAction { /* * Generated Methods */ /** * Method execute * @param mapping * @param form * @param request * @param response * @return ActionForward */ public ActionForward a(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { TestDispatchForm testDispatchForm = (TestDispatchForm) form; System.out.println("TestDispatchAction-->a"); return null; } public ActionForward b(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { TestDispatchForm testDispatchForm = (TestDispatchForm) form; System.out.println("TestDispatchAction-->b"); return null; } public ActionForward c(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { TestDispatchForm testDispatchForm = (TestDispatchForm) form; System.out.println("TestDispatchAction-->c"); return null; } } TestLookupDispatchAction.java /* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.hqh.struts.action; import java.util.HashMap; import java.util.Map; 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.LookupDispatchAction; import com.hqh.struts.form.TestLookupDispatchForm; /** * MyEclipse Struts * Creation date: 09-30-2007 * * XDoclet definition: * @struts.action path="/testLookupDispatch" name="testLookupDispatchForm" input="/form/testLookupDispatch.jsp" parameter="cmd" scope="request" validate="true" */ public class TestLookupDispatchAction extends LookupDispatchAction { /* * Generated Methods */ public ActionForward a(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { TestLookupDispatchForm testLookupDispatchForm = (TestLookupDispatchForm) form; System.out.println("TestLookupDispatchAction--a"); return null; } public ActionForward b(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { TestLookupDispatchForm testLookupDispatchForm = (TestLookupDispatchForm) form; System.out.println("TestLookupDispatchAction--b"); return null; } @Override protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("button.a", "a"); map.put("button.b", "b"); return map; } } TestMappingDispatchAction.java /* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.hqh.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.MappingDispatchAction; import com.hqh.struts.form.TestMappingDispatchForm; /** * MyEclipse Struts * Creation date: 09-30-2007 * * XDoclet definition: * @struts.action path="/testMappingDispatch" name="testMappingDispatchForm" input="/form/testMappingDispatch.jsp" parameter="a" scope="request" validate="true" */ public class TestMappingDispatchAction extends MappingDispatchAction { /* * Generated Methods */ public ActionForward a(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { TestMappingDispatchForm testMappingDispatchForm = (TestMappingDispatchForm) form; System.out.println("TestMappingDispatchAction-->a"); return null; } public ActionForward b(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { TestMappingDispatchForm testMappingDispatchForm = (TestMappingDispatchForm) form; System.out.println("TestMappingDispatchAction-->b"); return null; } }
发表评论
-
浅析Struts1和Struts2的Action线程安全问题
2013-11-30 22:23 456【问题描述】最近公司安排我面试Java的FreshMan,面试 ... -
Struts 的动态复选框
2009-05-05 17:49 1272在用户界面设计中,复 ... -
struts-config.xml的配置
2009-04-30 11:34 1263在Struts应用启动时,会把Struts配置文件中的配置信息 ... -
Struts源码研究 - logic-Iterator标签篇
2009-02-25 23:13 1379转载:http://hi.baidu.com/ja ... -
Struts源码研究 - Bean-Message标签篇
2009-02-25 12:15 1446转载:http://hi.baidu.com/javajava ... -
LookupDispatchAction的使用
2009-02-25 12:07 1259转载:http://hi.baidu.com/javajava ... -
ForwardAction、IncludeAction、SwitchAction
2009-02-25 10:00 1315转载:http://hi.baidu.com/javajava ... -
org.apache.commons.dbcp.BasicDataSource的解决方法
2009-02-24 15:39 63815转载: http://hi.baidu.com/javajav ... -
struts中的分页
2009-02-24 15:34 1215转载:http://hi.baidu.com/javajava ... -
一个简单的struts实现文件上传示例
2009-02-24 13:56 1415转载: http://hi.baidu.com/javajav ... -
struts 1 中服务器端限制文件上传的类型及扩展名
2009-02-24 12:53 3370转载: http://hi.baidu.com/javajav ... -
struts 1 中的文件上传 Action中的部分代码
2009-02-24 12:42 1495转载:http://hi.baidu.com/javajava ...
相关推荐
一个比较简单的struts的dispatchAction 类的入门案例,适合初学者理解dispatchAction
Struts(DispatchAction) + 存储过程 => 实现分页效果
Struts 之 DispatchAction add
最近自学java中的框架-struts写了一些小例子,这都是很经典的程序,如果大家瞧得起要下载去看看,顺便给俺找找不足的地方。我的qq 821865130 email qingtian_hechen@163.com 希望大家能多多给我帮助。在此谢谢各位!...
简单的DispatchAction实例。。。。。。。。
DispatchAction的作用简单地说就是把原来我们写在多个acton里的操作放在同一个 action里处理。
Struts1中怎样实现DispatchAction配置多个input属性\Struts1中怎样实现DispatchAction配置多个input属性
解决Struts1.x中使用Validator框架对DispatchAction不同方法使用不同的字段验证 你可以先参看我的blog文章:http://blog.csdn.net/qjyong/archive/2008/11/16/3311688.aspx 再决定是否下载。
利用struts标签,dispatchAction,实现增删改查 有利于初学者掌握struts!
03Struts2常用标签&DispatchAction.rar03Struts2常用标签&DispatchAction.rar03Struts2常用标签&DispatchAction.rar03Struts2常用标签&DispatchAction.rar
在页面中用js传递执行方法参数,传递到后台执行, 在你用的Action类中的方法名前加“run“及可被调用。
struts中的DispatchAction应用实例
struts1学习资料:里面包含struts源码工程 ActionServlet DispatchAction Action LookUpDispatchAction的用法 还包含html logic bean tiles标签的详细使用方法和validate验证框架的具体案例
自习struts时做时,大家可以互相交流一下
Struts 之 DispatchAction
JavaEE框架 Struts_In_Action(中文版) Struts Action Struts_In_Action LookupDispatchAction DispatchAction 对Action讲的比较仔细,可以深入的了解Struts框架里的基本原理。
ACCP_Y2_STRUTS指导学习1_青鸟搜藏.rar 添加书签,书签列表,TAG云图;三层结构,STRUTS,DISPATCHACTION,Struts报错机制
DispatchAction与MappingDispatchAction
import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.apache.struts.actions.DispatchAction等缺少
用struts1.2写的一个计算器示例程序,供研究struts原理的初学者参考,其中action继承的DispatchAction。