- 浏览: 326673 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
y_715:
document.getElementById("e ...
JSTL EC TABLE extremeTable 学习 -
wangyj0898:
学习了。。。
display table 标签用法 -
hejiajie2008:
没有图啊
图解myeclipse把maven普通java项目变成web项目的全程操作 -
zhangyu_2100:
[align=center][/align][color=br ...
request.getRealPath()的替代方法 -
senhui19:
LZ写的真不错呀,现在开发中都经常是用DetachedCrit ...
Hibernate的Criteria用法总结
功能:
通过请求的参数来决定该执行哪一个方法,而不像一般的Action,从Execute方法执行。在一个窗体中包括两个以上同名的按钮时,由Struts来决定具体执行那个按钮操作,减少了Action类,增加了请求处理的灵活性
AppFuse1.7与AppFuse1.8的BaseAction区别
AppFuse1.7是继承LookupDispatchAction, 需要复写 getKeyMethodMap()方法
具体可参考http://blog.csdn.net/GOALSTAR/archive/2005/12/05/543802.aspx
AppFuse1.8是继承DispatchAction
AppFuse1.8中BaseAction的主要方法
1.getBean()方法,得到Bean的对象
public Object getBean (String name) {
if (ctx == null) {
ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servlet.getServletContext());
}
return ctx.getBean(name);
}
2.convert() 对象转换方法,用来实现POJOs à ActionForm & ActionForm à POJOs 的转换
// 调用ConvertUtil#convert(java.lang.Object)
protected Object convert (Object o) throws Exception {
return ConvertUtil.convert(o);
}
3.execute()的方法
public ActionForward execute (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if (isCancelled(request)) {
try {
getMethod("cancel");
return dispatchMethod(mapping, form, request, response, "cancel");
} catch (NoSuchMethodException n) {
log.warn("No 'cancel' method found, returning null");
return cancelled(mapping, form, request, response);
}
}
// Check to see if methodName indicated by request parameter
String actionMethod = getActionMethodWithMapping(request, mapping);
if (actionMethod != null) {
return dispatchMethod(mapping, form, request, response, actionMethod);
} else {
String[] rules = {"edit", "save", "search", "view"};
for (int i = 0; i < rules.length; i++) {
// apply the rules for automatically appending the method name
if (request.getServletPath().indexOf(rules[i]) > -1) {
return dispatchMethod(mapping, form, request, response, rules[i]);
}
}
}
return super.execute(mapping, form, request, response);
}
在AppFuse1.8中BaseAction是继承DispatchAction , 使用struts时我们经常会用到DispatchAction.有了这个类,我们不需要针对每一个Action都要写一个特定的类,而是可以把一些相关的方法放到一个类中.
DispatchActon中使用了reflection来根据你传入的method参数的值来获取相应的参数来处理你的请求.正如他的方法 -- 他根据你传入的请求参数,用不同的方法来处理你的请求.
只要看看struts中DispatchAction(以下简写做DA)的源文件你就会发现,它有一个dispatchMethod方法,接受5个参数.其中4个就是我们通常的struts action里的(mapping,request,response,form),还有一个参数就是指定方法的参数的名字.
Ø Struts-config.xml中的配置
<action path="/editUser" ype="smarthings.webapp.action.UserAction" name="userForm" scope="request"
input="list" roles="admin" parameter="method" unknown="false" validate="false" >
<forward name="viewUsers" path="/editUser.html?method=Search( edit / save / delete )"/>
</action>
然后在Action中具体的实现Action都是继承了BaseAction的.比如
public final class PeopleAction extends BaseAction {
//具体的操作方法search
public ActionForward search(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
//具体的操作方法cancel
public ActionForward cancel(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {………}
//具体的操作方法delete
public ActionForward delete(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {………}
//具体的操作方法Edit
public ActionForward edit(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {……}
………
………
通过请求的参数来决定该执行哪一个方法,而不像一般的Action,从Execute方法执行。在一个窗体中包括两个以上同名的按钮时,由Struts来决定具体执行那个按钮操作,减少了Action类,增加了请求处理的灵活性
AppFuse1.7与AppFuse1.8的BaseAction区别
AppFuse1.7是继承LookupDispatchAction, 需要复写 getKeyMethodMap()方法
具体可参考http://blog.csdn.net/GOALSTAR/archive/2005/12/05/543802.aspx
AppFuse1.8是继承DispatchAction
AppFuse1.8中BaseAction的主要方法
1.getBean()方法,得到Bean的对象
public Object getBean (String name) {
if (ctx == null) {
ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servlet.getServletContext());
}
return ctx.getBean(name);
}
2.convert() 对象转换方法,用来实现POJOs à ActionForm & ActionForm à POJOs 的转换
// 调用ConvertUtil#convert(java.lang.Object)
protected Object convert (Object o) throws Exception {
return ConvertUtil.convert(o);
}
3.execute()的方法
public ActionForward execute (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if (isCancelled(request)) {
try {
getMethod("cancel");
return dispatchMethod(mapping, form, request, response, "cancel");
} catch (NoSuchMethodException n) {
log.warn("No 'cancel' method found, returning null");
return cancelled(mapping, form, request, response);
}
}
// Check to see if methodName indicated by request parameter
String actionMethod = getActionMethodWithMapping(request, mapping);
if (actionMethod != null) {
return dispatchMethod(mapping, form, request, response, actionMethod);
} else {
String[] rules = {"edit", "save", "search", "view"};
for (int i = 0; i < rules.length; i++) {
// apply the rules for automatically appending the method name
if (request.getServletPath().indexOf(rules[i]) > -1) {
return dispatchMethod(mapping, form, request, response, rules[i]);
}
}
}
return super.execute(mapping, form, request, response);
}
在AppFuse1.8中BaseAction是继承DispatchAction , 使用struts时我们经常会用到DispatchAction.有了这个类,我们不需要针对每一个Action都要写一个特定的类,而是可以把一些相关的方法放到一个类中.
DispatchActon中使用了reflection来根据你传入的method参数的值来获取相应的参数来处理你的请求.正如他的方法 -- 他根据你传入的请求参数,用不同的方法来处理你的请求.
只要看看struts中DispatchAction(以下简写做DA)的源文件你就会发现,它有一个dispatchMethod方法,接受5个参数.其中4个就是我们通常的struts action里的(mapping,request,response,form),还有一个参数就是指定方法的参数的名字.
Ø Struts-config.xml中的配置
<action path="/editUser" ype="smarthings.webapp.action.UserAction" name="userForm" scope="request"
input="list" roles="admin" parameter="method" unknown="false" validate="false" >
<forward name="viewUsers" path="/editUser.html?method=Search( edit / save / delete )"/>
</action>
然后在Action中具体的实现Action都是继承了BaseAction的.比如
public final class PeopleAction extends BaseAction {
//具体的操作方法search
public ActionForward search(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
//具体的操作方法cancel
public ActionForward cancel(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {………}
//具体的操作方法delete
public ActionForward delete(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {………}
//具体的操作方法Edit
public ActionForward edit(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {……}
………
………
发表评论
-
java.lang.NoClassDefFoundError: javax/el/ELException
2010-09-06 01:07 2560在maven中配置以下依赖: <depe ... -
配置过滤器
2009-12-28 12:04 1083配置过滤器,通过mapping ... -
关于div的隐藏
2009-12-28 12:01 1023div的visibility可以控制div的显示和隐藏,但是隐 ... -
request.getRealPath()的替代方法
2009-08-25 15:26 2825替代方法是: 写道 request.getSession( ... -
JSP注释详解(新手必看)
2009-07-03 14:14 1398在客户端显示一个注释. JSP 语法<!-- comme ... -
把JSP放到WEB-INF后以保护JSP源代码
2008-12-15 10:58 1570本人在看《J2EE核心模式》(“Core J2ee Patte ... -
struts配置文件中<forward>标签的redirect属性
2008-12-02 20:47 2354struts-config.xml中有这样 ... -
STRUTS中ec标签的用法
2008-11-25 16:41 24761.<ec:table items="pres ... -
JSP生成彩色验证码
2008-06-28 09:47 1213程序代码image.jsp<%@ page conten ... -
对表单输入的数据做校验
2008-05-23 20:11 1188对表单输入的数据做校验 在struts中带有了Jakarta ... -
活学活用 Struts (转)
2008-04-11 16:02 14841.概述 Struts大家都很熟悉,不再详细介绍,另 ... -
newValue
2008-03-17 13:14 1356public List getAllList(String x ... -
web开发设计displaytag应用指南
2008-03-10 15:26 1457DisplayTag是一个非常好用的表格显示标签,适合MVC模 ... -
display table 标签用法
2008-03-10 15:25 5631在web.xml下添加一个filter <filte ... -
jstl之foreach循环
2008-03-10 15:04 1528<%@ page contentType="t ... -
JSTL1.1函数标签库(functions)如fn:length
2008-03-10 15:02 14359在jstl中的fn标签也是我 ... -
JSP Struts之HTML标签库详解
2008-03-10 15:00 1847Struts提供了五个标签库,即:HTML、Bean、Logi ... -
web.xml详解
2008-03-10 14:51 5479web.xml元素介绍 每一个站的WEB-INF下都有一个we ... -
Struts配置文件详解(3)
2008-03-10 14:50 1234<?xml version="1.0" ... -
Struts配置文件详解(2)
2008-03-10 14:49 1774关于 Struts中 struts-config.xml文件的 ...
相关推荐
使用appfuse2.0,下载过来的实例源码,没有jar包
对用appfuse 做快速开发进行说明 本框架推荐使用的Tomcat版本为5.0.*,JDK使用1.4。若使用JDK 1.5+,则要将Tomcat安装目录下的common\endorsed 里面两个JAR(xercesImpl.jar,xmlParserAPIs.jar)去掉。Ps:...
本文档详细描述了AppFuse与SpringMVC+mybatis整合的过程,只要你懂一些基本的eclipse操作和基本的maven命令,就可以在三分钟之内迅速的搭建出一个AppFuse的架构
主要是自己从网络上搜集的一些关于appfuse1.8.2-2.0.2的一些相关资料,间或有点自己试验的记录,还有点maven和quartz的东东,之前我主要是用1.8.2构建项目,感觉还不错,希望对想学习appfuse的人有些帮助.
AppFuse2.1所需包,主要包括Spring MVC+Hibernate4 还有一些其它包!
appfuse 配置说明 doc 格式 框架 有截图
本文以一个 J2EE 开发者的角度,借助一个简单的应用示例,在融合了个人经验的基础上介绍了如何用 AppFuse 一步步地构建 J2EE 项目。通过阅读本文,读者不仅能够学会用 AppFuse 进行开发,而且能够充分体会到 AppFuse...
AppFuse是一个集成了众多当前最流行开源框架与工具(包括Hibernate、ibatis、Struts、Spring、DBUnit、Maven、Log4J、Struts Menu、Xdoclet、SiteMesh、OSCache、JUnit、JSTL等(现在还有lucene的,无敌了))于一身的...
Appfuse是一个开源的工程应用,它集成了现在最流行的开发框架到该应用中,使用Maven可以很方便的开发和部署因为。也可以集成到现在流行的开源开发工具如eclipse,idea等。现在让我们简单的看看APPFUSE开发应用的简单...
06年时的appfuse,学习SSH架构的经典入门框架。相对比较老的资料,可以欣赏一下当时的架构,向牛人致敬
代码自动生成工具appfuse的中文使用手册
详细的说明了appfuse的下载、安装、配置、创建项目、编译、部署、运行、生成源码的全过程。如果有问题 qq: 52288572
新手使用appfuse2.0,启动步骤和配置过程
用 户管理、根据不同的用户可以展现不同的菜单,可以自动生成40%-60%左右的代码,自带了默认的一些在CSS中设定的样式,使用这些样式能很快的改变整 个系统的外观,还有自动化测试的功能。 它最大的价值就是为我们...
Appfuse 一个开放源码的项目和应用程序,帮助我们快速而高效的地开发。
建立项目原型骨架的步骤(最新版本appfuse)appfuse2.1.0-M2 spring3.0 hibernte3.3 struts2.1.8
Appfuse框架解析,包括登陆验证,执行顺序,加载策略等。
Appfuse是由Matt Raible开发的一个指导性的入门级J2EE框架,它对如何集成流行的Spring、Hibernate、iBatis、struts、Xdoclet、junit 等基础框架给出了示范。提供了对Taperstry和JSF的支持
基于AppFuse框架的B2C电子商务系统研究与实现
NULL 博文链接:https://savagegarden.iteye.com/blog/427169