例如我在搭建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>
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