How FilterDispatcher reads the Struts.xml file
For Struts2 , we simply add this line inside web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
But could anybody please te开发者_如何学运维ll me , how it will know the path of struts.xml file ??
Struts2 looks for the struts.xml file at the root of the classpath. You can override the location using the config
init param, if needed.
The actual configuration is set up by the Dispatcher
class, irrespective of whether you use the older FilterDispatcher
or the newer StrutsPrepareAndExecuteFilter
.
精彩评论