此文件copy自struts2 reference.个人认为这个图对理解struts2非常有帮助,所以就拿来放到自己的博客上了。
In the diagram, an initial request goes to the Servlet container (such as Jetty or Resin) which is passed through a standard filter chain. The chain includes the (optional)ActionContextCleanUp
filter, which is useful when integrating technologies such as
SiteMesh Plugin
. Next, the required
FilterDispatcher
is called, which in turn consults theActionMapper
to determine if the request should invoke an action.
If the ActionMapper determines that an Action should be invoked, the FilterDispatcher delegates control to the
ActionProxy
. The ActionProxy consults the frameworkConfiguration Files
manager (initialized from the
struts.xml
file). Next, the ActionProxy creates an
ActionInvocation
, which is responsible for the command pattern implementation. This includes invoking any
Interceptors
(the
before
clause) in advance of invoking the
Action
itself.
Once the Action returns, the ActionInvocation is responsible for looking up the proper
result
associated with the
Action result code
mapped in
struts.xml
. The result is then executed, which often (but not always, as is the case for
Action Chaining
) involves a template written in
JSP
or
FreeMarker
to be rendered. While rendering, the templates can use the
Struts Tags
provided by the framework. Some of those components will work with the ActionMapper to render proper URLs for additional requests.
|
All objects in this architecture (Actions,
Results
,
Interceptors
, and so forth) are created by an
ObjectFactory
. This ObjectFactory is pluggable. We can provide our own ObjectFactory for any reason that requires knowing when objects in the framework are created. A popular ObjectFactory implementation uses Spring as provided by the
Spring Plugin
. |
Interceptors are executed again (in reverse order, calling the
after
clause). Finally, the response returns through the filters configured in the
web.xml
. If the ActionContextCleanUp filter is present, the FilterDispatcher will
not
clean up the ThreadLocal
ActionContext
. If the ActionContextCleanUp filter is not present, the FilterDispatcher will cleanup all ThreadLocals.
注意:与struts1不同,struts2对用户的每一次请求都会创建一个action,所以struts2的action是线程安全的。
struts1中的action是singleton(单例)的,struts2中的action是prototype(原型)的。
- 大小: 64.7 KB
分享到:
相关推荐
S2SH框架图,理解S2SH结构很有帮助。
struts2架构图
struts核心架构分析图struts核心架构分析图struts核心架构分析图struts核心架构分析图
Struts2的架构和运行流程 之 3.1 Struts2的系统架构
Struts2技术架构图
Struts2-架构图.PNG
都市供求信息网-struts2架构的例程序(sqlserver数据库),本人亲自运行。
struts2_1架构图
struts 框架原理图 原理流程 跳转
各种系统架构图及其简介(Spring+IBatis+Struts1+Struts2+Hibernat)
运用struts2架构实现网上图书商店,功能齐全,页面用jsp实现,十分美观。
登录角色分为用户与管理员,用户功能:1、注册、登录、修改个人信息 2、上传、下载、搜索、查看图文,管理员功能:1、注册、登录、修改个人信息 2、上传、下载、删除、搜索、查看图文 3、对违规用户进行封号
struts工作原理图、spring框架结构图、hibernate工作原理图
里面是struts2的架构的图解,用图的方式展现了struts2的核心,它里面具体的流程是什么
Struts2体系结构图例详解 MVC框架
《Struts 2实战》结合实例介绍了Struts 2框架,主要内容包括Action、Result、Interceptor等框架组件,基于注解的配置选项等新特征,Struts 2插件 FreeMarker,如何从Struts 1和WebWork 2迁移到Struts 2,Ajax标签、...
2、写pojo. 3、配置web.xml (分别配置sping,struts) 4、写sping的application和applicationservices或者其它配置.(可对些文件分为其它文件,在web.xml中注册即可) 5、配置struts.xml 6、配置sqlmapconfig.xml,如果有...
struts、hibernate框架,含部分spring框架内容,初学期间笔记,部分内容可能有误
struts2拦截器和验证框架
文档包含了JVM、Struts、Spring、J2EE、Android等架构图