struts体系结构
问题: 为什么 invoke()方法,一旦执行,表示action方法执行完毕,jsp页面已经处理完毕; 其返回值再修改无意义,不影响结果??
解释:
着重看如下颜色的字:
■
■
官方文档有明确的说明:
The diagram describes the framework's architecture.
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 the ActionMapper 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)[博主注:指的是String result = invocation.invoke();方法之上的代码] 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).[博主注:指的是String result = invocation.invoke();方法之下的代码] 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.
(有空再翻译吧~~)
struts体系结构的更多相关文章
- Struts核心技术简介
Struts核心技术简介 1.Struts内部机制 Struts是一种基于MVC经典设计模式的开发源代码的应用框架,它通过把Servlet.JSP.JavaBean.自定义标签和信息资源整合到一个 ...
- Struts框架 内部资料 请勿转载 谢谢合作
Struts框架 struts框架具有组件的模块化,灵活性和重用性的优点,同时简化了基于MVC的web应用程序的开发. 本章详细讨论struts架构.我们将看到struts是如何清晰地区分控制,事务逻 ...
- 菜鸟学习Struts——总结
一.原理 客户端请求到ActionSeverlet,ActionSeverlet负责截URL进行分发分发到每一个Action上,Action负责和Model打交道然后把相关信息返回到ActionSev ...
- 华为的JAVA面试题及答案(部分)
华为的JAVA面试题 (后记:没有想到华为的面试题就是非同一般,非常多题不是一眼就行看得出来,至少对我这种鸟来说是这样.对我个人来说,看看这种题,可能比看<Think In Java>都还 ...
- java面试题系列11
华为的JAVA面试题 QUESTION NO: 1 publicclass Test1 { publicstaticvoid changeStr(String str){ ...
- 华为JAVA(面试问题及答案节)
华为JAVA面试题 (后记:我没想到华为面试题是不寻常,,至少对我这种鸟来说是这样.对我个人来说.看看这样的题.可能比看<Think In Java>都还要好.因为这里面有很多的东西,都是 ...
- j2EE经典面试题
1. hibernate中离线查询去除重复项怎么加条件? dc.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); 2. http协议及端口,sm ...
- Spring官方文档翻译——15.1 介绍Spring Web MVC框架
Part V. The Web 文档的这一部分介绍了Spring框架对展现层的支持(尤其是基于web的展现层) Spring拥有自己的web框架--Spring Web MVC.在前两章中会有介绍. ...
- 轻量级Java EE企业应用实战(第4版):Struts 2+Spring 4+Hibernate整合开发(含CD光盘1张)
轻量级Java EE企业应用实战(第4版):Struts 2+Spring 4+Hibernate整合开发(含CD光盘1张)(国家级奖项获奖作品升级版,四版累计印刷27次发行量超10万册的轻量级Jav ...
随机推荐
- 【CRC校验】学习笔记
#include<stdio.h> unsigned ]= { 0x01,0x02,0x03,0x04,0x05,0x06 }; ] = { 0x0000, 0x1021, 0x2042, ...
- POJ1410 Intersection 计算几何
题目大意:给出一个线段的两端,和矩形两端(不一定是左上和右下),问线段是否与矩形相交(若线段在矩形内也算相交).这题蒸鹅心-- 题目思路:判断所有情况:线段是否在矩形内,线段内一点是否在矩形内,线段是 ...
- python2.7学习记录之二
一.高级特性 1.切片取前3个元素用L[0:3]表示,从索引0开始取,直到索引3为止,但不包括索引3.如果第一个索引是0可省略.前10个数 每两个取一个L[:10:2],所有数 每5个取一个L[::5 ...
- Android系统手机端抓包方法(tcpdump)
抓包准备 1. Android手机需要先获得root权限.一种是否获得root权限的检验方法:安装并打开终端模拟器(可通过安卓市场等渠道获得).在终端模拟器界面输入su并回车,若报错则说明未root, ...
- Q promise API简单翻译
详细API:https://github.com/kriskowal/q/wiki/API-Reference Q提供了promise的一种实现方式,现在在node中用的已经比较多了.因为没有中文的a ...
- 关于Unicode字符集
最初的unicode编码是固定长度的,16位,也就是2两个字节代表一个字符,这样一共可以表示65536个字符.显然,这样要表示各种语言中所有的字符是远远不够的.Unicode4.0规范考虑到了这种情况 ...
- android网络编程之HttpUrlConnection的讲解--实现文件的断点上传
1.网络开发不要忘记在配置文件中添加访问网络的权限 <uses-permission android:name="android.permission.INTERNET"/& ...
- As3.0 Interface 与类的使用
来源:http://blog.sina.com.cn/s/blog_4d65c19e0100bfkb.html 抽象类:又叫抽象基类:可以包含一般类所包含的所有特性,例如,字段,属性,方法,抽象类不能 ...
- docker 基础命令
检查Docker安装是否正确docker info拉取镜像docker pull (image name)启动docker run -d -d 后台运行查看日志docker logs $sample_ ...
- centos中apache-tomcat的配置
在centos中配置Apache-toncat需要先安装jdk,前面文章已经写了怎么配置jdk,这里略过. 首先到官网下载好Apache-tomcat安装包,我这里下载的是apache-tomcat- ...