zoukankan      html  css  js  c++  java
  • Struts2工作原理

    Struts2请求响应流程:

     

    在struts2的应用 中,从用户请求到服务器返回相应响应给用户端的过程中,包含了许多组件如:Controller、ActionProxy、ActionMapping、 Configuration Manager、ActionInvocation、Inerceptor、Action、Result等。下面我们来具体看看这些组件有什么联系,它们 之间是怎样在一起工作的。

    (1)  客户端(Client)向Action发用一个请求(Request)

    (2)  Container通过web.xml映射请求,并获得控制器(Controller)的名字

    (3)  容器(Container)调用控制器(StrutsPrepareAndExecuteFilter或FilterDispatcher)。在 Struts2.1以前调用FilterDispatcher,Struts2.1以后调用StrutsPrepareAndExecuteFilter

    (4)  控制器(Controller)通过ActionMapper获得Action的信息

    (5)  控制器(Controller)调用ActionProxy

    (6)  ActionProxy读取struts.xml文件获取action和interceptor stack的信息。

    (7)  ActionProxy把request请求传递给ActionInvocation

    (8)  ActionInvocation依次调用action和interceptor

    (9)  根据action的配置信息,产生result

    (10) Result信息返回给ActionInvocation

    (11) 产生一个HttpServletResponse响应

    (12) 产生的响应行为发送给客服端。

  • 相关阅读:
    CCF模拟题 窗口
    CSUOJ 1541 There is No Alternative
    MySQL数据库优化的八种方式(经典必看)
    PHP面向对象-----魔术方法
    PHP面向对象(OOP)----分页类
    2017最新PHP初级经典面试题目汇总(下篇)
    2017最新PHP经典面试题目汇总(上篇)
    原型模式
    适配器模式
    策略模式
  • 原文地址:https://www.cnblogs.com/qinying/p/4427522.html
Copyright © 2011-2022 走看看