The nature of the Interceptor:
An interceptor is a class, a class that implements the interceptor of a super interface. The Interceptor interface defines three methods of Init (), Destory (), intercept (). where Inercept () is the core method, the parameter of the method is invocation, and its type is the Actioninvocatio interface, which defines the core method of interception invoke ();
The interceptor-oriented aspect programming (AOP), which inserts the necessary ancillary services before or after the execution of the target code, reduces the coupling of the system. The target code of the Struts2 Interceptor is action.
Steps to use interceptors:
1. First create a class that implements the Interceptor interface. This class is the core code of the Interceptor execution, which executes before and after the target object.
Note that interceptor is a super interface and it implements three methods. Alternatively you can inherit the Abstractinterceptor abstract class, just implement the Interceptor () method on the line. Alternatively, you can inherit the Methodfilterinterceptor abstract class, just implement the Dointercept () method.
2. ( important ) Configure the Interceptor in the Struts.xml package: first declare the Interceptor, then put the custom interceptor into the interceptor stack.
Error-prone when configuring interceptors, collect the following data references:
Http://www.blogjava.net/zzzlyr/archive/2009/10/12/297998.html
Order of execution of interceptors:
The interceptor stack is called the Order of implementation, if an interceptor stack has a,b,c three interceptors, then their order of execution is a,b,c,action,c,b,a.
STRUTS2 Interceptor Summary