Struts2 拦截器过滤方法

1、struts.xml属性

excludeMethods参数指定拦截器拒绝拦截的方法列表,多个用英文逗号隔开

includeMethods参数指定拦截器需要拦截的方法列表,多个用英文逗号隔开

 

2、方法拦截器代码

MethodFilterInterceptor抽象类重写了AbstractInterceptor类中的Intercept()方法,还提供了doIntercept(ActionInvocation paramActionInvocation)方法

3、效果

输入地址 http://localhost:9900/pmgz/delete ,跳转页面

控制台

delete()方法本来返回时"error",这里被方法拦截器拦截匹配跳转为"success"匹配页面去了

 

看下login方法

posted @ 2016-07-14 22:58  星空夜  阅读(502)  评论(0编辑  收藏  举报