在springmvc.xml文件里添加:
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.xxx.xxx.interceptor.XxxInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
"/**" 代表拦截所有请求。
在springmvc.xml文件里添加:
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.xxx.xxx.interceptor.XxxInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
"/**" 代表拦截所有请求。