<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns= "http://xmlns.jcp.org/xml/ns/ Java ee " xmlns:xsi=" http://www.w3.org/2001/ Xmlschema-instance " xsi:schemalocation=" http// Xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd " version= "3.1" > <welcome-file-list> <welcome-file>index.do</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>index.html</welcome-file> </welcome-file-list > <!-- Activate Tomcat defaultservlet to handle static resources --> < !--<servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> < Servlet-name>default</servlet-name> <url-pattern >*.gif</url-pattern> </servlet-mapping> < servlet-mapping> <servlet-name>default</ Servlet-name> <url-pattern>*.png</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping> <servlet-mapping > <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping>--> <!--Set filter filters to solve Chinese garbled problem--> <filter> <filter-name>encodingfilter</ Filter-name> <filter-class> org.springframework.web.filter.characterencodingfilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name> forceencoding</param-name> < Param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>EncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!--spring and security configuration files--> < context-param> <param-name>contextconfiglocation</ Param-name> &nbsP; <param-value>classpath:applicationcontext.xml,classpath:spring-security.xml </param-value> </context-param> <context-param > <param-name>webAppRootKey</param-name> <param-value>lingdong.webapp.root</param-value> </context-param> <!--spring security Filters-- <filter> <filter-name> Springsecurityfilterchain</filter-name> <filter-class >org.springframework.web.filter.delegatingfilterproxy</filter-class> </ filter> <filter-mapping> < Filter-name>springsecurityfilterchAin</filter-name> <url-pattern>/*</url-pattern > </filter-mapping> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</ listener-class> </listener> <listener> <listener-class> org.springframework.security.web.session.httpsessioneventpublisher</listener-class> </listener> <!--spring mvc configuration file--> <servlet> <servlet-name>springmvc</servlet-name > <servlet-class> org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name> springmvc</servlet-name> <url-pattern>*.do</ url-pattern> </servlet-mapping> <!--Cancel empty lines produced by the JSP language-- > <jsp-config> < jsp-property-group> <url-pattern>*.jsp</url-pattern> <trim-directive-whitespaces>true</ Trim-directive-whitespaces> </jsp-property-group> </jsp-config></web-app>
This article is from the Java Technology Blog blog, so be sure to keep this source http://lingdong.blog.51cto.com/3572216/1883106
Spring MVC and Spring security Configure the Web. XML setting