java - 请问 /* 和 / 的区别是什么?
PHPz
PHPz 2017-04-18 09:13:58
0
1
855

例如我在搭建Spring MVC时,在web.xml中进行如下基本的配置。请问<url-pattern>/*</url-pattern><url-pattern>/</url-pattern>的区别是什么?谢谢。

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

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
PHPz
PHPz

学习是最好的投资!

reply all(1)
小葫芦

I have also been confused about this problem. I saw a discussion on csdn http://bbs.csdn.net/topics/390610045
If configured as /, springMVC will treat all .jsp.. as txt. The result is that the jsp source code is loaded directly in the browser

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template