【mmall】url-pattern配置为"/"和"/*"的区别

时间:2021-07-23 20:03:12

我的代码

<!-- springmvc -->
<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:springmvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <!--拦截比较-->
    <url-pattern>/</url-pattern>
    <url-pattern>/*</url-pattern>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>

参考链接:url-pattern配置为"/"和"/*"的区别