Spring MVC and Spring security Configure the Web. XML setting

Source: Internet
Author: User

<?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/1883107

Spring MVC and Spring security Configure the Web. XML setting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.