springMVC static resource mapping

1. In the following code web.xml

<servlet>
        <servlet-name>springDispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:springMvc-*.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>springDispatcherServlet</servlet-name>
        <!-- <url-pattern>*.do</url-pattern> -->
        <url-pattern>/</url-pattern>
    </servlet-mapping>

2. Add the following code in the configuration file springMVC

 

Guess you like

Origin www.cnblogs.com/mcl2238973568/p/11455493.html