第一步
静态资源过滤是否加上了
<!--静态资源过滤:防止web.xml中的DispatcherServlet将statis文件下的静态资源也过滤掉-->
<mvc:resources location="/static/" mapping="/static/**"/>
第二步
拦截器中是否也加上不拦截静态资源,因为上面只是mvc中的DispatcherServlet过滤,而这个是拦截器中的拦截
<!--自定义拦截器-->
<mvc:interceptors>
<!-- 验证是否登录 通过cookie -->
<mvc:interceptor>
<!-- 拦截所有mvc控制器 -->
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/user/login"/>
<mvc:exclude-mapping path="/static/**"/> <!--大坑!!! 拦截器拦截的所有请求,包括静态资源-->
<bean class="ltd.study.interceptor.TokenInterceptor"></bean>
</mvc:interceptor>
</mvc:interceptors>