Struts2 拦截器过滤方法

it2026-02-06  2

1、struts.xml属性

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

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

 

2、方法拦截器代码

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

3、效果

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

控制台

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

 

看下login方法

转载于:https://www.cnblogs.com/daidai-99/p/5672038.html

最新回复(0)