0、Struts2的运行机制
当你在客户端敲http://localhost:8080/strust2test/hello
首先找到:strust2test这个web application,找到后去执行这个web application下的web.xml
Tomcat接收到请求之后,会发现这个web.xml下面,配了一个filter,而这个filter过滤所有的url地址,所以当我们在地址栏敲http://localhost:8080/strust2test/hello后,会被StrutsPrepareAndExecuteFilter接收到
<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>
<package name="default" namespace="/" extends="struts-default"> <action name="hello" > <result>/hello.jsp</result> </action></package>