struts2的执行流程

在浏览器端输入相应的访问地址》》》》把请求发送给tomact》》》》tomact判断应该交给那个webApplication》》》》读取webApplication下面的web.xml》》》》

<filter>
<filter-name>
struts2
</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

在web.xml配置文件下有*/,它会过滤所有请求,交给org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter类的doFilter()方法》》》》读取struts-xml文件》》》》根据用户请求的地址找到相应的package、action、result》》》》将对应的jsp页面返回给浏览器。

恒之贵,何必三更起五更睡;最无益,只怕一日曝十日寒。
原文地址:https://www.cnblogs.com/flqcchblog/p/4322489.html