1.
Interceptor (Interceptor ):
The Interceptor is the core of Struts2, and all functions of Struts2 are implemented through the interceptor.
2.
Interceptor Configuration
1) Write a class that implements the Interceptor interface.
2) define the interceptor in the struts. xml file.
3) Use interceptor in action
3.
Once the interceptor is defined and configured to the action, we need to add the default interceptor Stack: defaultStack at the end of the action.
4.
When defining the Interceptor, you can directly inherit the AbstractInterceptor abstract class (this class implements the Interceptor interface and implements the empty implementation of the init and destroy methods), and then implement its abstract method intercept.
5.
Method filter Interceptor (an interceptor that intercepts a specified method ).
6.
In the method filter interceptor, if neither the includeMethods parameter nor the execludeMethods parameter is specified, all methods are blocked, that is, all methods are considered includeMethods; if includeMethods is specified, only the methods in includeMethods are blocked. Methods not included in includeMethods are not blocked.
You are welcome to join us in the discussion and study!
Collect it by yourself!
Record and share, let you grow together! Welcome to my other blog; my blog address: http://blog.csdn.net/caicongyang