<mvc:interceptors>
<bean class="Interceptor.UserInterceptor"/>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/hello1"/>
<bean class="Interceptor.MyInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
为什么不会拦截 http://localhost:8080/,按道理来说index.jsp页面不应该会被拦截吗
我猜是你前面套的 WebServer 配置了
default
之类的参数,根目录这种的直接被 WebServer 处理掉了,不会进到你的程序里。你可以搜索“SpringMVC+拦截器+根目录”得到你想要的结果。