<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<!-- 使用bean定义一个Interceptor,直接定义在mvc:interceptors根下面的Interceptor将拦截所有的请求 -->
<mvc:exclude-mapping path="/admin/index" />
<bean class=" com.emark.filter.AuthIntercepter" />
</mvc:interceptor>
<!-- <mvc:interceptor> <mvc:mapping path="/test/number.do" /> 定义在mvc:interceptor下面的表示是对特定的请求才进行拦截的
<bean class="com.host.app.web.interceptor.LoginInterceptor" /> </mvc:interceptor> -->
</mvc:interceptors>
如果有
mvc:exclude-mapping 请不要写在最外面。。另外 bean class 要写在mvc interceptor 底部,
此外头文件要加入以下几句:
xmlns:mvc="http://www.springframework.org/schema/mvc"
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd