Struts 2 framework relies upon Interceptors to do most of the work before and after an action is executed. Interceptors are by default part of Struts 2 default stack and are executed in a specific order. Interceptors are used to process logic before and after an action is called. They can also change the state of an action before it executes.
Interceptors are standard Java classes that prevent duplicate actions from firing. Interceptors are pluggable, which means that you can decide which features an Action needs to support and which it should ignore.
Interceptors are invoked by the controller before and after an action is called.
However, one can also specify and write their own stack of interceptors that the Action or package should use on a per-action basis and add it to the already existing Interceptors in the framework.
|Alias Interceptor||alias||Alias Interceptor helps in converting similar parameters.|
|Chaining Interceptor||chain||Chaining Interceptor allows tge current Action to access the properties of previous Action.|
|Checkbox Interceptor||checkbox||Checkbox Interceptor detects any unchecked checkbox and add it as a parameter with a false value.|
|Cookie Interceptor||cookie||Cookie Interceptor adds customizable name / value in a cookie.|
|CookieProvider Interceptor||cookieProvider||CookieProvider Interceptor transfer cookies from action to response|
|Conversion Error Interceptor||conversionError||Conversion Error Interceptor adds conversion errors in the error field of Action|
|Create Session Interceptor||createSession||Create Session Interceptor creates an HttpSession automatically|
|Debugging Interceptor||debugging||Debugging Interceptor with the use of several debugging screens informs about the data behind the page.|
|Execute and Wait Interceptor||execAndWait||Execute and Wait Interceptor while executing the Action in background redirects the user to a waiting page.|
|Exception Interceptor||exception||Exception Interceptor maps exceptions to a result.|
|File Upload Interceptor||fileUpload||File Upload Interceptor adds easy access to file upload.|
|I18n Interceptor||i18n||I18n Interceptor remembers the locale of a user session.|
|Logger Interceptor||logger||Logger Interceptor gives the name of the Action.|
|Message Store Interceptor||store||Message Store Interceptor store and retrieves action or error messages for action that implements ValidationAware interface into session.|
|Model Driven Interceptor||modelDriven||Whenever action implements ModelDriven, Model Driven Interceptor adds the getModel Result onto the Value Stack.|
|Scoped Model Driven Interceptor||scopedModelDriven||When the action implements ScopedModelDriven, Scoped Model Driven Interceptor will retrieve the model from a scope and provide it to the action calling setModel.|
|Parameters Interceptor||params||Parameters Interceptor sets the request parameters onto the Action.|
|Prepare Interceptor||prepare||Prepare Interceptor calls prepare() on actions which implement Preparable. It ensures that a logic runs before the execute method runs.|
|Scope Interceptor||scope||Scope Interceptor stores action state in the session or application scope.|
|Servlet Config Interceptor||servletConfig||Servlet Config Interceptor provide access to HttpServletRequest and HttpServletResponse.|
|Static Parameters Interceptor||staticParams||You can define the Static Parameters while configuring your action class in the struts.xml. The defined static params in the struts.xml file will be added to the request params map.|
|Roles Interceptor||roles||Roles Interceptor is executed if the user has the correct role.|
|Timer Interceptor||timer||Timer Interceptor determines how long the Action takes to execute in milliseconds.|
|Token Interceptor||token||Token Interceptor checks that a single valid token is processed in Action.|
|Token Session Interceptor||tokenSession||Token Session Interceptor checks that a single valid token is processed in Action but when an invalid token is processed it stores the submitted data in session.|
|Validation Interceptor||validation||Validation Interceptors checks the action against any validation rules using the validators.|
|Default Workflow Interceptor||workflow||Default Workflow Interceptor makes sure that there are no validation error before the interceptor chain continues.|
|Parameter Filter Interceptor||N/A||Parameter Filter Interceptor removes or blocks parameters from getting to the rest of the stack or your action.|
|Profiling Interceptor||profiling||Profiling Interceptor activates or deactivates profiling through parameter.|
|Multiselect Interceptor||multiselect||Multiselect Interceptor adds an empty parameter if no value is selected for a field with multiple values.|
Read more tutorials at Struts 126.96.36.199 tutorials section, which gives advanced tutorials about the Struts 2 framework.
Liked it! Share this Tutorial