首页 > 代码库 > SpringMVC 拦截器
SpringMVC 拦截器
public class LoginIntercetor implements HandlerInterceptor{ @Override public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { System.out.println("进入拦截器"); return true; } @Override public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { System.out.println("postHandler"); } @Override public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { System.out.println("处理完成"); }}
<!--配置拦截器--> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <bean class="com.core.LoginIntercetor"/> <!--那些类不进入拦截器--> <!--<mvc:exclude-mapping path=""></mvc:exclude-mapping>--> </mvc:interceptor> <mvc:interceptor> <mvc:mapping path="/**"/> <bean class="com.core.LoginIntercetor"/> </mvc:interceptor> </mvc:interceptors>
SpringMVC 拦截器
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。