struts体系结构
2015-09-23 21:41
423 查看
问题: 为什么 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.
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.
(有空再翻译吧~~)
来自为知笔记(Wiz)
解释:
着重看如下颜色的字:
■
■
官方文档有明确的说明:
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. |
(有空再翻译吧~~)
来自为知笔记(Wiz)
相关文章推荐
- java hibernate +mysql demo
- java14 处理流
- java13 InputStream,Reader
- HDU1026 Ignatius and the Princess I(java)
- java12 File类
- java11 Guava:谷歌开发的集合库
- 在Eclipse中添加Servlet-api.jar的方法
- eclipse控制台输出重定向到…
- java10 WeakHashMap
- java08 Set
- java07 map
- Android studio导入eclipse项目且不改变目录结构
- 认识理解Java中native方法
- java06
- java05
- 韩顺平 java 第十六讲 数组
- Spring AOP简述
- java04
- Java—— 随机抽取扑克牌游戏
- java解析json数据