<?xml version= "1.0" encoding= "UTF-8"?>
<web-app version= "2.5" xmlns= "Http://java.sun.com/xml/ns/javaee"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >
<display-name>Luke</display-name>
<!--Template-->
<!--xxxxxxxxxxxxxxxstartxxxxxxxxxxxxxxx-->
<!--xxxxxxxxxxxxxxxxendxxxxxxxxxxxxxxxx-->
<!--xxxxxxxxxxxxxxxspring configuration and monitoring startxxxxxxxxxxxxxxx-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.content.ContextLoaderListener</listener-class>
</listener>
<!--xxxxxxxxxxxxxxxxspring configuration and monitoring endxxxxxxxxxxxxxxxx-->
<!--xxxxxxxxxxxxxxx filter (filter) Writing instructions startxxxxxxxxxxxxxxx-->
<!--
A. Single filter to match multiple paths to write multiple corresponding filter mapping
B. Other filters must be placed in front of the Struts2 filter, otherwise invalid
-->
<!--
Filter mapping rules
1. Priority exact path matching:
Take/* and/test as an example, Http://localhost:8080/Test will first find/test
Similarly, long path matching is similar to exact path matching, and/test/* and/test/a/* will prioritize the latter
The end of the slash plus star or the trailing slash plus path are all path matching
2. Extension matching:
*.action and *.do extensions match, which exactly matches which
Star Dot "*." symbol is the definition extension match
3. Default matching:
When a matching servlet is not found and the default servlet is set, the request is thrown to the default servlet
A normal single "/" symbol is defined as the default servlet
-->
<!--xxxxxxxxxxxxxxxx filter (filter) Writing instructions endxxxxxxxxxxxxxxxx-->
<!--xxxxxxxxxxxxxxxopensessioninviewfilter configuration startxxxxxxxxxxxxxxx-->
<!--
Opensessioninviewfilter is spring's support for Hibernate's headache session shutdown latency Issue
It has initialization parameters (Init-param) singlesession, the default is true,
If set to False, the filter is useless, and can be used as a setting switch.
-->
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--xxxxxxxxxxxxxxxxopensessioninviewfilter configuration endxxxxxxxxxxxxxxxx-->
<!--xxxxxxxxxxxxxxxStruts2 filter startxxxxxxxxxxxxxxx-->
<!--
Using Strutsprepareandexecutefilter as a Struts2 filter,
Strutsprepareandexecutefilter has become the official recommended filter
Initialize and process Web requests in place of the original Filterdispatcher
-->
<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>
<!--xxxxxxxxxxxxxxxxStruts2 filter endxxxxxxxxxxxxxxxx-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
This article from Csdn Blog, reproduced please indicate the source: http://blog.csdn.net/lukelsq/archive/2010/02/26/5330605.aspx