struts2运行流程

1.首先客户端发送请求

2.请求经过 一系列过滤器最后到达web.xml中配置的StrutsPrepareAndExecuteFilter核心过滤器

3.StrutsPrepareAndExecuteFilter询问ActionMapper是否需要请求action。

4.如果需要调用action,过滤器把请求交给ActionProxy,ActionProxy通过ConfigurationManager读取struts.xml配置文件,找到需要调用的Action。

5.ActionProxy创建ActionInvocation,经过一系列拦截器,ActionInvocation调用Action

6.找到完整类名执行struts.xml文件中action标签中配置的方法(默认方法execute)

7.ActionInvocation根据返回值在struts.xml中寻找结果集

8.返回result结果集中配置的jsp页面给 客户端

------------------------------------------------------------------------------------

简单版

1.客户端发送请求

2.StrutsPrepareAndExecuteFilter接收请求读取struts.xml配置文件

3.从struts.xml文件中找到对应的action

4.根据完整类名找到action执行struts.xml中配置的方法(默认方法execute)

5.执行方法,根据返回值匹配struts.xml中的result结果集

6.返回结果集中配置 的jsp页面给客户端

原文地址:https://www.cnblogs.com/suni/p/8649882.html