<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/admin/**"/>
<mvc:mapping path="/client/**"/>
<bean class="InterceptorTest"/>
</mvc:interceptor>
</mvc:interceptors>
InterceptorTest类:
public class InterceptorTest implements HandlerInterceptor{
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object arg2) throws Exception {
//XXXXXXXXXXXXXXXXXXXXXX
return true;
}
}
这样,所有的 mvc:mapping里面的请求,都会被拦截。
网友评论