1. Struts2架构图
这是S truts2官方站点提供的Struts 2 的整体结构。
2. Struts2部分类介绍
这部分从Struts2参考文档中翻译就可以了。
ActionMapper
ActionMapper其实是HttpServletRequest和Action调用请求的一个映射,它屏蔽了Action对于Request等java Servlet类的依赖。Struts2中它的默认实现类是DefaultActionMapper,ActionMapper很大的用处可以根据自己的需要来设计url格式,它自己也有Restful的实现,具体可以参考文档的docs\actionmapper.html。
ActionProxy&ActionInvocation
Action的一个代理,由ActionProxyFactory创建,它本身不包括Action实例,默认实现DefaultActionProxy是由ActionInvocation持有Action实例。ActionProxy作用是如何取得Action,无论是本地还是远程。而ActionInvocation的作用是如何执行Action,拦截器的功能就是在ActionInvocation中实现的。
ConfigurationProvider&Configuration
ConfigurationProvider就是Struts2中配置文件的解析器,Struts2中的配置文件主要是尤其实现类XmlConfigurationProvider及其子类StrutsXmlConfigurationProvider来解析。
3. Struts2请求流程
1、客户端发送请求
2、请求先通过ActionContextCleanUp-->FilterDispatcher
3、FilterDispatcher通过ActionMapper来决定这个Request需要调用哪个Action
4、如果ActionMapper决定调用某个Action,FilterDispatcher把请求的处理交给ActionProxy,这儿已经转到它的Delegate--Dispatcher来执行
5、ActionProxy根据ActionMapping和ConfigurationManager找到需要调用的Action类
6、ActionProxy创建一个ActionInvocation的实例
7、ActionInvocation调用真正的Action,当然这涉及到相关拦截器的调用
8、Action执行完毕,ActionInvocation创建Result并返回,当然,如果要在返回之前做些什么,可以实现PreResultListener。添加PreResultListener可以在Interceptor中实现。
另一个版本:大同小异~
一个请求在Struts2框架中的处理大概分为以下几个步骤:
1. 客户端提起一个(HttpServletRequest)请求,如上文在浏览器中输入”http://localhost:8080/TestMvc/add.action”就是提起一个(HttpServletRequest)请求。
2. 请求被提交到一系列(主要是三层)的过滤器(Filter),如(ActionContextCleanUp、其他过滤器(SiteMesh等)、 FilterDispatcher)。注意这里是有顺序的,先ActionContextCleanUp,再其他过滤器(SiteMesh等)、最后到FilterDispatcher。
3. FilterDispatcher是控制器的核心,就是mvc中c控制层的核心。下面粗略的分析下我理解的FilterDispatcher工作流程和原理:FilterDispatcher进行初始化并启用核心doFilter
其代码如下:
Java代码 复制代码
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException ...{
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
ServletContext servletContext = filterConfig.getServletContext();
// 在这里处理了HttpServletRequest和HttpServletResponse。
DispatcherUtils du = DispatcherUtils.getInstance();
du.prepare(request, response); //正如这个方法名字一样进行locale、encoding以及特殊request parameters设置
try ...{
request = du.wrapRequest(request, servletContext); //对request进行包装
} catch (IOException e) ...{
String message = "Could not wrap servlet request with MultipartRequestWrapper!" ;
LOG.error(message, e);
throw new ServletException(message, e);
}
ActionMapperIF mapper = ActionMapperFactory.getMapper(); //得到action的mapper
ActionMapping mapping = mapper.getMapping(request); // 得到action 的 mapping
if (mapping == null ) ...{
// there is no action in this request, should we look for a static resource?
String resourcePath = RequestUtils.getServletPath(request);
if ( "" .equals(resourcePath) && null != request.getPathInfo()) ...{
resourcePath = request.getPathInfo();
}
if ( "true" .equals(Configuration.get(WebWorkConstants.WEBWORK_SERVE_STATIC_CONTENT))
&& resourcePath.startsWith( "/webwork" )) ...{
String name = resourcePath.substring( "/webwork" .length());
findStaticResource(name, response);
} else ...{
// this is a normal request, let it pass through
chain.doFilter(request, response);
}
// WW did its job here
return ;
}
Object o = null ;
try ...{
//setupContainer(request);
o = beforeActionInvocation(request, servletContext);
//整个框架最最核心的方法,下面分析
du.serviceAction(request, response, servletContext, mapping);
} finally ...{
afterActionInvocation(request, servletContext, o);
ActionContext.setContext( null );
}
}
du.serviceAction(request, response, servletContext, mapping);
//这个方法询问ActionMapper是否需要调用某个Action来处理这个(request)请求,如果ActionMapper决定需要调用某个Action,FilterDispatcher把请求的处理交给ActionProxy
public void serviceAction(HttpServletRequest request, HttpServletResponse response, String namespace, String actionName, Map requestMap, Map parameterMap, Map sessionMap, Map applicationMap) ...{
HashMap extraContext = createContextMap(requestMap, parameterMap, sessionMap, applicationMap, request, response, getServletConfig()); //实例化Map请求 ,询问ActionMapper是否需要调用某个Action来处理这个(request)请求
extraContext.put(SERVLET_DISPATCHER, this );
OgnlValueStack stack = (OgnlValueStack) request.getAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY);
if (stack != null ) ...{
extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
}
try ...{
ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(namespace, actionName, extraContext);
//这里actionName是通过两道getActionName解析出来的, FilterDispatcher把请求的处理交给ActionProxy,下面是ServletDispatcher的 TODO:
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());
proxy.execute();
//通过代理模式执行ActionProxy
if (stack != null )...{
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY,stack);
}
} catch (ConfigurationException e) ...{
log.error( "Could not find action" , e);
sendError(request, response, HttpServletResponse.SC_NOT_FOUND, e);
} catch (Exception e) ...{
log.error( "Could not execute action" , e);
sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
}
}
4. FilterDispatcher询问ActionMapper是否需要调用某个Action来处理这个(request)请求,如果ActionMapper决定需要调用某个Action,FilterDispatcher把请求的处理交给ActionProxy。
5. ActionProxy通过Configuration Manager(struts.xml)询问框架的配置文件,找到需要调用的Action类.
如上文的struts.xml配置
Java代码 复制代码
<?xml version= "1.0" encoding= "GBK" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd" >
<struts>
<include file= "struts-default.xml" />
< package name= "struts2" extends = "struts-default" >
<action name= "add"
class = "edisundong.AddAction" >
<result>add.jsp</result>
</action>
</ package >
</struts>
如果提交请求的是add.action,那么找到的Action类就是edisundong.AddAction。
6. ActionProxy创建一个ActionInvocation的实例,同时ActionInvocation通过代理模式调用Action。但在调用之前ActionInvocation会根据配置加载Action相关的所有Interceptor。(Interceptor是struts2另一个核心级的概念)
下面我们来看看ActionInvocation是如何工作的:
ActionInvocation 是Xworks 中Action 调度的核心。而对Interceptor 的调度,也正是由ActionInvocation负责。ActionInvocation 是一个接口, 而DefaultActionInvocation 则是Webwork 对ActionInvocation的默认实现。
Interceptor 的调度流程大致如下:
1. ActionInvocation初始化时,根据配置,加载Action相关的所有Interceptor。
2. 通过ActionInvocation.invoke方法调用Action实现时,执行Interceptor。
Interceptor将很多功能从我们的Action中独立出来,大量减少了我们Action的代码,独立出来的行为具有很好的重用性。XWork、WebWork的许多功能都是有Interceptor实现,可以在配置文件中组装Action用到的Interceptor,它会按照你指定的顺序,在Action执行前后运行。
那么什么是拦截器。
拦截器就是AOP(Aspect-Oriented Programming)的一种实现。(AOP是指用于在某个方法或字段被访问之前,进行拦截然后在之前或之后加入某些操作。)
拦截器的例子这里就不展开了。
struts-default.xml文件摘取的内容:
Java代码 复制代码
< interceptor name = "alias" class = "com.opensymphony.xwork2.interceptor.AliasInterceptor" />
< interceptor name = "autowiring" class = "com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor" />
< interceptor name = "chain" class = "com.opensymphony.xwork2.interceptor.ChainingInterceptor" />
< interceptor name = "conversionError" class = "org.apache.struts2.interceptor.StrutsConversionErrorInterceptor" />
< interceptor name = "createSession" class = "org.apache.struts2.interceptor.CreateSessionInterceptor" />
< interceptor name = "debugging" class = "org.apache.struts2.interceptor.debugging.DebuggingInterceptor" />
< interceptor name = "external-ref" class = "com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor" />
< interceptor name = "execAndWait" class = "org.apache.struts2.interceptor.ExecuteAndWaitInterceptor" />
< interceptor name = "exception" class = "com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor" />
< interceptor name = "fileUpload" class = "org.apache.struts2.interceptor.FileUploadInterceptor" />
< interceptor name = "i18n" class = "com.opensymphony.xwork2.interceptor.I18nInterceptor" />
< interceptor name = "logger" class = "com.opensymphony.xwork2.interceptor.LoggingInterceptor" />
< interceptor name = "model-driven" class = "com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor" />
< interceptor name = "scoped-model-driven" class = "com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor" />
< interceptor name = "params" class = "com.opensymphony.xwork2.interceptor.ParametersInterceptor" />
< interceptor name = "prepare" class = "com.opensymphony.xwork2.interceptor.PrepareInterceptor" />
< interceptor name = "static-params" class = "com.opensymphony.xwork2.interceptor.StaticParametersInterceptor" />
< interceptor name = "scope" class = "org.apache.struts2.interceptor.ScopeInterceptor" />
< interceptor name = "servlet-config" class = "org.apache.struts2.interceptor.ServletConfigInterceptor" />
< interceptor name = "sessionAutowiring" class = "org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor" />
< interceptor name = "timer" class = "com.opensymphony.xwork2.interceptor.TimerInterceptor" />
< interceptor name = "token" class = "org.apache.struts2.interceptor.TokenInterceptor" />
< interceptor name = "token-session" class = "org.apache.struts2.interceptor.TokenSessionStoreInterceptor" />
< interceptor name = "validation" class = "com.opensymphony.xwork2.validator.ValidationInterceptor" />
< interceptor name = "workflow" class = "com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor" />
< interceptor name = "store" class = "org.apache.struts2.interceptor.MessageStoreInterceptor" />
< interceptor name = "checkbox" class = "org.apache.struts2.interceptor.CheckboxInterceptor" />
< interceptor name = "profiling" class = "org.apache.struts2.interceptor.ProfilingActivationInterceptor" />
7. 一旦Action执行完毕,ActionInvocation负责根据struts.xml中的配置找到对应的返回结果。如上文中将结构返回“add.jsp”,但大部分时候都是返回另外一个action,那么流程又得走一遍………
这是S truts2官方站点提供的Struts 2 的整体结构。
2. Struts2部分类介绍
这部分从Struts2参考文档中翻译就可以了。
ActionMapper
ActionMapper其实是HttpServletRequest和Action调用请求的一个映射,它屏蔽了Action对于Request等java Servlet类的依赖。Struts2中它的默认实现类是DefaultActionMapper,ActionMapper很大的用处可以根据自己的需要来设计url格式,它自己也有Restful的实现,具体可以参考文档的docs\actionmapper.html。
ActionProxy&ActionInvocation
Action的一个代理,由ActionProxyFactory创建,它本身不包括Action实例,默认实现DefaultActionProxy是由ActionInvocation持有Action实例。ActionProxy作用是如何取得Action,无论是本地还是远程。而ActionInvocation的作用是如何执行Action,拦截器的功能就是在ActionInvocation中实现的。
ConfigurationProvider&Configuration
ConfigurationProvider就是Struts2中配置文件的解析器,Struts2中的配置文件主要是尤其实现类XmlConfigurationProvider及其子类StrutsXmlConfigurationProvider来解析。
3. Struts2请求流程
1、客户端发送请求
2、请求先通过ActionContextCleanUp-->FilterDispatcher
3、FilterDispatcher通过ActionMapper来决定这个Request需要调用哪个Action
4、如果ActionMapper决定调用某个Action,FilterDispatcher把请求的处理交给ActionProxy,这儿已经转到它的Delegate--Dispatcher来执行
5、ActionProxy根据ActionMapping和ConfigurationManager找到需要调用的Action类
6、ActionProxy创建一个ActionInvocation的实例
7、ActionInvocation调用真正的Action,当然这涉及到相关拦截器的调用
8、Action执行完毕,ActionInvocation创建Result并返回,当然,如果要在返回之前做些什么,可以实现PreResultListener。添加PreResultListener可以在Interceptor中实现。
另一个版本:大同小异~
一个请求在Struts2框架中的处理大概分为以下几个步骤:
1. 客户端提起一个(HttpServletRequest)请求,如上文在浏览器中输入”http://localhost:8080/TestMvc/add.action”就是提起一个(HttpServletRequest)请求。
2. 请求被提交到一系列(主要是三层)的过滤器(Filter),如(ActionContextCleanUp、其他过滤器(SiteMesh等)、 FilterDispatcher)。注意这里是有顺序的,先ActionContextCleanUp,再其他过滤器(SiteMesh等)、最后到FilterDispatcher。
3. FilterDispatcher是控制器的核心,就是mvc中c控制层的核心。下面粗略的分析下我理解的FilterDispatcher工作流程和原理:FilterDispatcher进行初始化并启用核心doFilter
其代码如下:
Java代码 复制代码
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException ...{
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
ServletContext servletContext = filterConfig.getServletContext();
// 在这里处理了HttpServletRequest和HttpServletResponse。
DispatcherUtils du = DispatcherUtils.getInstance();
du.prepare(request, response); //正如这个方法名字一样进行locale、encoding以及特殊request parameters设置
try ...{
request = du.wrapRequest(request, servletContext); //对request进行包装
} catch (IOException e) ...{
String message = "Could not wrap servlet request with MultipartRequestWrapper!" ;
LOG.error(message, e);
throw new ServletException(message, e);
}
ActionMapperIF mapper = ActionMapperFactory.getMapper(); //得到action的mapper
ActionMapping mapping = mapper.getMapping(request); // 得到action 的 mapping
if (mapping == null ) ...{
// there is no action in this request, should we look for a static resource?
String resourcePath = RequestUtils.getServletPath(request);
if ( "" .equals(resourcePath) && null != request.getPathInfo()) ...{
resourcePath = request.getPathInfo();
}
if ( "true" .equals(Configuration.get(WebWorkConstants.WEBWORK_SERVE_STATIC_CONTENT))
&& resourcePath.startsWith( "/webwork" )) ...{
String name = resourcePath.substring( "/webwork" .length());
findStaticResource(name, response);
} else ...{
// this is a normal request, let it pass through
chain.doFilter(request, response);
}
// WW did its job here
return ;
}
Object o = null ;
try ...{
//setupContainer(request);
o = beforeActionInvocation(request, servletContext);
//整个框架最最核心的方法,下面分析
du.serviceAction(request, response, servletContext, mapping);
} finally ...{
afterActionInvocation(request, servletContext, o);
ActionContext.setContext( null );
}
}
du.serviceAction(request, response, servletContext, mapping);
//这个方法询问ActionMapper是否需要调用某个Action来处理这个(request)请求,如果ActionMapper决定需要调用某个Action,FilterDispatcher把请求的处理交给ActionProxy
public void serviceAction(HttpServletRequest request, HttpServletResponse response, String namespace, String actionName, Map requestMap, Map parameterMap, Map sessionMap, Map applicationMap) ...{
HashMap extraContext = createContextMap(requestMap, parameterMap, sessionMap, applicationMap, request, response, getServletConfig()); //实例化Map请求 ,询问ActionMapper是否需要调用某个Action来处理这个(request)请求
extraContext.put(SERVLET_DISPATCHER, this );
OgnlValueStack stack = (OgnlValueStack) request.getAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY);
if (stack != null ) ...{
extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
}
try ...{
ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(namespace, actionName, extraContext);
//这里actionName是通过两道getActionName解析出来的, FilterDispatcher把请求的处理交给ActionProxy,下面是ServletDispatcher的 TODO:
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());
proxy.execute();
//通过代理模式执行ActionProxy
if (stack != null )...{
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY,stack);
}
} catch (ConfigurationException e) ...{
log.error( "Could not find action" , e);
sendError(request, response, HttpServletResponse.SC_NOT_FOUND, e);
} catch (Exception e) ...{
log.error( "Could not execute action" , e);
sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
}
}
4. FilterDispatcher询问ActionMapper是否需要调用某个Action来处理这个(request)请求,如果ActionMapper决定需要调用某个Action,FilterDispatcher把请求的处理交给ActionProxy。
5. ActionProxy通过Configuration Manager(struts.xml)询问框架的配置文件,找到需要调用的Action类.
如上文的struts.xml配置
Java代码 复制代码
<?xml version= "1.0" encoding= "GBK" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd" >
<struts>
<include file= "struts-default.xml" />
< package name= "struts2" extends = "struts-default" >
<action name= "add"
class = "edisundong.AddAction" >
<result>add.jsp</result>
</action>
</ package >
</struts>
如果提交请求的是add.action,那么找到的Action类就是edisundong.AddAction。
6. ActionProxy创建一个ActionInvocation的实例,同时ActionInvocation通过代理模式调用Action。但在调用之前ActionInvocation会根据配置加载Action相关的所有Interceptor。(Interceptor是struts2另一个核心级的概念)
下面我们来看看ActionInvocation是如何工作的:
ActionInvocation 是Xworks 中Action 调度的核心。而对Interceptor 的调度,也正是由ActionInvocation负责。ActionInvocation 是一个接口, 而DefaultActionInvocation 则是Webwork 对ActionInvocation的默认实现。
Interceptor 的调度流程大致如下:
1. ActionInvocation初始化时,根据配置,加载Action相关的所有Interceptor。
2. 通过ActionInvocation.invoke方法调用Action实现时,执行Interceptor。
Interceptor将很多功能从我们的Action中独立出来,大量减少了我们Action的代码,独立出来的行为具有很好的重用性。XWork、WebWork的许多功能都是有Interceptor实现,可以在配置文件中组装Action用到的Interceptor,它会按照你指定的顺序,在Action执行前后运行。
那么什么是拦截器。
拦截器就是AOP(Aspect-Oriented Programming)的一种实现。(AOP是指用于在某个方法或字段被访问之前,进行拦截然后在之前或之后加入某些操作。)
拦截器的例子这里就不展开了。
struts-default.xml文件摘取的内容:
Java代码 复制代码
< interceptor name = "alias" class = "com.opensymphony.xwork2.interceptor.AliasInterceptor" />
< interceptor name = "autowiring" class = "com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor" />
< interceptor name = "chain" class = "com.opensymphony.xwork2.interceptor.ChainingInterceptor" />
< interceptor name = "conversionError" class = "org.apache.struts2.interceptor.StrutsConversionErrorInterceptor" />
< interceptor name = "createSession" class = "org.apache.struts2.interceptor.CreateSessionInterceptor" />
< interceptor name = "debugging" class = "org.apache.struts2.interceptor.debugging.DebuggingInterceptor" />
< interceptor name = "external-ref" class = "com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor" />
< interceptor name = "execAndWait" class = "org.apache.struts2.interceptor.ExecuteAndWaitInterceptor" />
< interceptor name = "exception" class = "com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor" />
< interceptor name = "fileUpload" class = "org.apache.struts2.interceptor.FileUploadInterceptor" />
< interceptor name = "i18n" class = "com.opensymphony.xwork2.interceptor.I18nInterceptor" />
< interceptor name = "logger" class = "com.opensymphony.xwork2.interceptor.LoggingInterceptor" />
< interceptor name = "model-driven" class = "com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor" />
< interceptor name = "scoped-model-driven" class = "com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor" />
< interceptor name = "params" class = "com.opensymphony.xwork2.interceptor.ParametersInterceptor" />
< interceptor name = "prepare" class = "com.opensymphony.xwork2.interceptor.PrepareInterceptor" />
< interceptor name = "static-params" class = "com.opensymphony.xwork2.interceptor.StaticParametersInterceptor" />
< interceptor name = "scope" class = "org.apache.struts2.interceptor.ScopeInterceptor" />
< interceptor name = "servlet-config" class = "org.apache.struts2.interceptor.ServletConfigInterceptor" />
< interceptor name = "sessionAutowiring" class = "org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor" />
< interceptor name = "timer" class = "com.opensymphony.xwork2.interceptor.TimerInterceptor" />
< interceptor name = "token" class = "org.apache.struts2.interceptor.TokenInterceptor" />
< interceptor name = "token-session" class = "org.apache.struts2.interceptor.TokenSessionStoreInterceptor" />
< interceptor name = "validation" class = "com.opensymphony.xwork2.validator.ValidationInterceptor" />
< interceptor name = "workflow" class = "com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor" />
< interceptor name = "store" class = "org.apache.struts2.interceptor.MessageStoreInterceptor" />
< interceptor name = "checkbox" class = "org.apache.struts2.interceptor.CheckboxInterceptor" />
< interceptor name = "profiling" class = "org.apache.struts2.interceptor.ProfilingActivationInterceptor" />
7. 一旦Action执行完毕,ActionInvocation负责根据struts.xml中的配置找到对应的返回结果。如上文中将结构返回“add.jsp”,但大部分时候都是返回另外一个action,那么流程又得走一遍………
发表评论
-
菜鸟 Spring 源码解读 推荐流程
2012-01-11 09:18 5053Spring源代码解析(一):IOC容器:http://www ... -
深入剖析Classloader(一)--类的主动使用与被动使用
2011-12-27 22:13 1053我们知道java运行的是这样的,首先java编译器将我们的源代 ... -
Java中连接字符串时是使用+号还是使用StringBuilder?
2011-12-26 14:04 886字符串是Java程序中最常用的一种数据结构之一。在Java中的 ... -
转一篇有关Java的内存泄露的文章(受益哦)
2011-07-20 09:28 7331 引言 Java的一个 ... -
Tomcat内存溢出的原因
2011-07-19 09:41 698Tomcat内存溢出的原因 在生产环境中tomcat内 ... -
深入研究java.lang.ThreadLocal类
2011-07-13 09:39 654一、概述 ThreadLocal是什么呢?其实Thread ... -
jboss中实现跨war包session同步
2011-06-12 23:28 1231跨war包session同步解决方 ... -
开源框架spring详解-----AOP的深刻理解
2011-05-26 22:13 1201开源框架spring详解-----AOP的深刻理解 AOP的 ... -
Spring注入方式及用到的注解 -----@Component,@Service,@Controller,@Repository
2011-05-26 15:04 1188注入方式: 把DAO实现 ... -
Java中的native关键字浅析(Java Native Interface)
2011-05-21 23:13 698JNI是Java Native Interface的 ... -
Volatile 变量
2011-04-26 17:01 597Java 语言中的 volatile 变量可以被看作是一种 “ ... -
Java对象的强、软、弱和虚引用
2011-04-26 16:04 5931.Java对象的强、软、 ... -
Web 应用程序常见漏洞 CSRF 的入侵检测与防范
2011-04-23 15:00 1066简介: 互联网的安全问题一直存在,并且在可预见的未来中没有消弭 ... -
详解XSS跨站脚本攻击
2011-04-23 13:46 1107一、什么是XSS攻击 XSS ... -
CSRF攻击原理解析
2011-04-22 10:29 12420×00. 前言 在Web程序中 ... -
selenium 初步体检之富文本框操作
2011-04-20 20:10 1486public class LoginTest extends ... -
webx
2011-03-05 17:54 960webx 学习笔记。 -
Java读带有BOM的UTF-8文件乱码解决方法
2011-03-02 11:12 2384Java default io reader does not ... -
java sftp tools
2011-02-24 13:30 1484import java.io.File; import jav ... -
HtmlUnit
2010-10-18 22:27 1625IntroductionThe dependencies pa ...
相关推荐
struts2核心工作流程与原理.pdfstruts2核心工作流程与原理.pdfstruts2核心工作流程与原理.pdfstruts2核心工作流程与原理.pdfstruts2核心工作流程与原理.pdf
struts2核心工作流程与原理.doc
Struts 2框架本身大致可以分为3个部分:核心控制器FilterDispatcher、业务控制器Action和用户实现的企业业务... Struts 2的工作流程相对于Struts 1要简单,与WebWork框架基本相同,所以说Struts 2是WebWork的升级版本。
专题资料
一个请求在Struts 2框架中的处理大概分为以下几个步骤。...Struts 2的核心控制器是FilterDispatcher,有3个重要的方法:destroy()、doFilter()和Init(),可以在Struts 2的下载文件夹中找到源代码,如代码1所示。
struts的执行的核心流程时序图
本章讲述Struts2的工作原理 读者如果曾经学习过Struts1.x或者有过Struts1.x的开发经验...虽然Struts2的开发小组极力保留Struts1.x的习惯,但因为Struts2的核心设计完全改变,从思想到设计到工作流程,都有了很大的不同
1.3.3 Struts 2的工作原理 12 1.4 小结 14 第2章 初识Struts 2 16 2.1 声明性架构 16 2.1.1 两种配置 16 2.1.2 声明架构的两种方式 17 2.1.3 智能默认值 20 2.2 简单的HelloWorld示例 20 2.2.1 部署示例应用程序 20...
个人中的SSH详细介绍,包括struts1的工作原理、Struts1优缺点(为什么要用strust1)、struts1的工作原理及基本配置详解、struts2工作原理、struts2运行机制、Struts2的工作流程、Struts2工作原理、Struts1与Struts2...
struts1的几个核心组件是值得我们注意的: 1 、ActionServlet(核心控制器)。 2、RequestProcessor类(处理异常的核心组件)。 3、ActionForm(接收页面中传过的数据)。 4、Action(是控制器,主要是从ActionForm中...
struts控制器核心源代码及解释,对希望彻底掌握struts MVC模式工作流程及原理的朋友有帮助。
Struts原理、开发及项目实施 Holen 2002-9-12 <br/>1、 摘要 2、 关键词 3、 Framework 4、 Struts的起源 5、 Struts工作原理 6、 Struts安装 7、 一个实例 8、 Struts优缺点...
第4章到第7章深入探讨了Struts框架的核心组件ActionServlet和RequestProcessor的实现原理,详细介绍了开发Struts应用的模型、视图和控制器的各种技术,细致的描述了Struts配置文件的每个元素的使用方法。第8章到第9...
第4章到第7章深入探讨了Struts框架的核心组件ActionServlet和RequestProcessor的实现原理,详细介绍了开发Struts应用的模型、视图和控制器的各种技术,细致的描述了Struts配置文件的每个元素的使用方法。第8章到第9...
第4章到第7章深入探讨了Struts框架的核心组件ActionServlet和 RequestProcessor的实现原理,详细介绍了开发Struts应用的模型、视图和控制器的各种技术,细致的描述了Struts配置文件的每个元素的使用方法。...
通过学习这个系统,你可以深入了解Struts框架的工作原理和使用方法,提高自己的Java Web开发能力。同时,这个项目也可以帮助初学者快速掌握图书管理系统的开发流程和技术要点,为今后的工作和学习打下坚实的基础。...
关于struts小实例,里附有开发程序的详细解释与对应对Struts核心 ,工程流程原理 ,启动后Struts里流走顺序,是初学者的很好参考实例
第4章到第7章深入探讨了Struts框架的核心组件ActionServlet和RequestProcessor的实现原理,详细介绍了开发Struts应用的模型、视图和控制器的各种技术,细致的描述了Struts配置文件的每个元素的使用方法。第8章到第9...
第4章到第7章深入探讨了Struts框架的核心组件ActionServlet和 RequestProcessor的实现原理,详细介绍了开发Struts应用的模型、视图和控制器的各种技术,细致的描述了Struts配置文件的每个元素的使用方法。...