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 ...
随机推荐
- @ResponseBody返回json时,json数据丢失或者报错
现象: 1.报错:There is a cycle in the hierarchy! 2.返回至前台的json不完整,字段丢失. 错误原因: eg:entity1的属性有list<entiti ...
- js深入理解构造函数和原型对象
1.在典型的oop的语言中,如java,都存在类的概念,类就是对象的模板,对象就是类的实例.但在js中不存在类的概念,js不是基于类,而是通过构造函数(constructor)和原型链(propoty ...
- Yii2.0官方高级模板的目录结构分析
Yii 是什么 Yii 是一个高性能,基于组件的 PHP 框架,用于快速开发现代 Web 应用程序.名字 Yii (读作 易)在中文里有"极致简单与不断演变"两重含义,也可看作 Y ...
- IIS启用GZip压缩
IIS启用GZip压缩,是提高网站速度和减轻服务器负载的一个优化手段和方法,经测试,网站启用GZip压缩后,速度快了3倍!而配置起来也相当的简单,因此被广大网站管理员使用.本文将详细介绍如何在IIS启 ...
- win8.1去掉鼠标右键回收站“固定到开始”屏幕的方法
平台:win8.1 问题:桌面“回收站”右键菜单里有个“固定到开始屏幕”,一不小心就误按,设法删除之. 打开注册表编辑器.在注册表编辑器里面定位到:HKEY_LOCAL_MACHINE\SOFTWAR ...
- 《剑指Offer》算法题——替换空格
题目:请实现一个函数,将一个字符串中的空格替换成“ % 20”.例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are % 20Happy. class Solution ...
- apache 添加到windows服务
cmd命令行下 输入 “d:\apache\bin\httpd.exe” -k install 如果是resin的话直接运行目录下的setup就可以了, 前提是需要.net framework 3.5
- data Mining with Weka: Trailer More Data Mining with Weka 用weka 进行数据挖掘 Weka 用weka 进行更多数据挖掘
https://www.youtube.com/user/WekaMOOC 大学公开课 视频教程 weka 入门教程 data Mining with Weka: Trailer More Dat ...
- Number-guessing Game
Number-guessing Game Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Othe ...
- js里写网页结构, 传函数参数
如题 "<td align='center' height='30px' width='80px'><a href='javascript:sort(\"&quo ...