如果要对动作类的指定方法进行拦截,则拦截器的类需要继续MethodFilterInterceptor
//实现doIntercept //这样子还是不能去拦截指定方法
公共类Myintercetor扩展了MethodFilterInterceptor {
公共字符串doIntercept(ActionInvocation调用)抛出异常{
2. 在struts.xml action中配置要拦截的方法和不需要拦截的方法 <action name =“dom_ *”class =“com.sun.action.DomeAction”method =“{1}”>
<result name =“no”> / home.jsp </ result>
<interceptor-ref name =“defaultStack”> </ interceptor-ref>
<interceptor-ref name =“dem”>
<param name =“excludeMethods”> add,update </ param> <! - 指定不需要拦截的方法 - >
<param name =“includeMethods”> query,find </ param> <! - 指定需要拦截的方法 - >
</interceptor-ref>
</action>