Interceptor是在action前后执行,那么在action之后的处理如何实现呢?Struts2提供了一个抽象类AroundInterceptor,即通过interceptor()方法对ActionInvocation.invoke()方法进行递归调用,ActionInvocation循环嵌套在intercept()中,一直到语句result=invocation.invoke();
执行结束即:Action执行完并返回结果result.这时Interceptor对象会按照港开始执行的逆向顺序依次执行结果。这样,before方法在Action之前执行,after方法在Action方法之后执行。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有