zoukankan      html  css  js  c++  java
  • Struts2运行流程分析

    一.Struts2运行流程图:

    二.运行流程分析:

    1. 请求发送给StrutsPrepareAndExecuteFilter
    2.StrutsPrepareAndExecuteFilter询问ActionMapper请求是否是一个Struts2请求(即是否返回一个非空的ActionMapping对象)
    3. ActionMapper认为该请求是一个Struts2请求,则StrutsPrepareAndExecuteFilter请求的处理交给ActionProxy
    4. ActionProxy通过ConfigurationManager  读取框架的配置文件,确定需要调用Action类及Action方法
    5. ActionProxy创建ActionInvocation的实例,并进行初始化
    6. ActionInvocation实例在调用Action的过程前后,涉及到相关拦截器(Intercepter)的调用
    7.Action执行完毕,ActionInvocation负责根据struts.xml的配置找到对应的返回结果。调用Result的execute方法,渲染结果。在渲染的过程中可以使用Struts2框架中的标签
    8. 执行各个拦截器invocation.invoke()之后的代码
    9. 把结果发送到客户端
    三、相关API

    ActionMappingSimpleclass that holds the action mapping information used to invoke a Struts action.The name and namespace arerequired
    ActionMapperWhengiven anHttpServletRequest, theActionMapper mayreturn null if no action invocation request matches, or it may return anActionMapping thatdescribes an action invocation for the framework totry
    ActionProxyActionProxy isan extra layer betweenXWork andthe action so that different proxies are possible.
    ActionInvocationAnActionInvocation represents the execution state of an Action. It holds the Interceptors and the Action instance. By repeated re-entrant execution of the invoke() method,initially by theActionProxy,then by the Interceptors, the Interceptors are all executed, and then the Action and the Result.

  • 相关阅读:
    ckeditor 3.0.1使用
    也谈QQ表情弹出框的制作
    百度的模态弹出窗口
    day03 set集合,文件操作,字符编码以及函数式编程
    写在开始之前
    day07 类的进阶,socket编程初识
    day06 面向对象编程
    day02 Python 的模块,运算,数据类型以及方法
    day04 装饰器 迭代器&生成器 Json & pickle 数据序列化 内置函数
    day08 多线程socket 编程,tcp粘包处理
  • 原文地址:https://www.cnblogs.com/elgin-seth/p/5293739.html
Copyright © 2011-2022 走看看