web.xml中DispatcherServlet拦截器的配置详情

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>

 <servlet>

    <servlet-name>app</servlet-name>
       <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:app-servlet.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>app</servlet-name>

<!-- "/"表示拦截所有的请求(除了jsp),可以访问首页index.jsp,并可以接受所有请求到app-servlet.xm中处理-->

<!-- "/*"表示拦截所有请求(包括jsp), 不能访问任何首页,因为都被拦截放到app-servet.xml中做处理了-->

<!--  "*.html"表示拦截后缀为html的请求,能访问首页index.jsp,不能访问index.html(被拦截放到app-servlet.xml中了),-->  <! --  而且只能获取到html后缀的请求-->

<!--  "*.jsp"的配置结果则与"*.html"的配置结果相反,所有*.jsp请求被拦截到app-servlet.xml中做处理,index.jsp不能访问-->

<!--  只能访问index.html -->

    <url-pattern>/</url-pattern>
  </servlet-mapping>


---------------------
https://blog.csdn.net/qq_16734411/article/details/80196011 

 

posted @ 2019-04-27 14:51  厚雨青  阅读(2580)  评论(0编辑  收藏  举报