导航

Struts2的运行机制

Posted on 2012-10-25 09:34  阿里大盗  阅读(136)  评论(0)    收藏  举报

1.Browser发送http请求给Tomcat,Tomcat根据URL选择应用(webapp)。

2.该webapp首先搜寻自己的web.xml中的filter(依据URL),然后确定是哪个filter需要被调用(这里是Struts2),于是调用Struts2的某个类的doFilter()。

3.Struts2开始依据URL搜寻Struts.xml文件,根据namespace和action名来确定执行哪个Action。

4.执行Action并依据返回值找到对应的result,执行result。