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) 产生的响应行为发送给客服端。

  • 相关阅读:
    唐伯虎
    朱元璋
    [再寄小读者之数学篇](2014-06-28 证明级数几乎处处收敛)
    [家里蹲大学数学杂志]第053期Legendre变换
    About the Importance of Aim in Life
    An Apple a day keeps the doctor away
    Love Me,Love My Dog
    关于工作
    关于失败
    Erdos
  • 原文地址:https://www.cnblogs.com/jasonzeng888/p/5996336.html
Copyright © 2011-2022 走看看