spring mvc web.xml文件配置中
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/login"/>
<ref bean="loginHandlerInterceptor"/>
</mvc:interceptor>
<mvc:interceptor>
<mvc:mapping path="/*"/>
<mvc:exclude-mapping path="/login"/>
<ref bean="watchHandlerInterceptor"/>
</mvc:interceptor>
</mvc:interceptors> 报错:
no declaration can be found for element 'mvc:interceptors'.
在xml文件开头beans里加上
xmlns:mvc="http://www.springframework.org/schema/mvc
xsi里加上
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
就OK了
本文介绍如何在SpringMVC中正确配置拦截器,解决因XML命名空间未定义而导致的配置错误问题,并提供了解决方案。

1218

被折叠的 条评论
为什么被折叠?



