拦截器(Interceptor)中的invocation.invoke()是什么意思?

拦截器(Interceptor)中的invocation.invoke()是什么意思?

最佳答案:

invocation.invoke() 就是通知struts2接着干下面的事情
比如 调用下一个拦截器 或 执行下一个Action
就等于退出了你自己编写的这个interceptor了

 

如何使用struts2拦截器,或者自定义拦截器。特别注意,在使用拦截器的时候,在Action里面必须最后一定要引用struts2自带的拦截器缺省堆栈defaultStack,如下(这里我是引用了struts2自带的checkbox拦截器):

<interceptor-ref name="checkbox">
  <param name="uncheckedValue">0</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"/>
(必须加,否则出错)

转载出处:http://blog.csdn.net/cruise_h/article/details/10004407

原文地址:https://www.cnblogs.com/wym789/p/6368498.html