zoukankan      html  css  js  c++  java
  • struts2 工作流程

    1)客户端发出请求(HttpServletRequst)

    2)这个请求经过了一系列的 Filter 过滤器来传递,如果 struts 2 与 site Mesh 或其他插件进行了继承,则请求首先要经过可选的 ActionContextCleanUp 过滤器

    3)调用 FilterDispatcher , FilterDispatcher 是控制其的核心,它通过询问 ActionMapper 来确定该请求是否需要调样某个Action 。如果需要调用某个 action。则 FilterDispatcher 就把该请求转交给  ActionProxy。

    4)ActionProxy 通过 配置管理器 Configuration Manager 询问框架的配置文件 struts.xml,从而找到需要调样的 Action 类。

    5)ActionProxy 创建一个 ActionInvocation 的实例,该实例通过命令模式来调用。在 Action 执行的前后,ActionInvocation 实例根据配置文件加载与 Action 相关的左右拦截器 Intercepter。

    6)一旦 Action执行完毕, ActionInvocation 实例根据 struts.xml 文件中的配置找到相对应的返回结果。返回结果通过是一个 JSP 或者 FreeMarker 的模板。

    7)最后,HttpServletResponse 响应通过 web.xml 文件中配置的过滤器返回。

  • 相关阅读:
    操作集锦
    大吉大利(算贡献)
    96. 奇怪的汉诺塔
    P760通天之汉诺塔
    First Last Sorting
    9.12小结
    day_06
    day_05作业
    day_05
    day_04
  • 原文地址:https://www.cnblogs.com/pengweiqiang/p/8809216.html
Copyright © 2011-2022 走看看