Struts 2 Interceptors Tutorial

Interceptor is an article that is summoned at the preprocessing and postprocessing of a solicitation. In Struts 2, interceptor is utilized to perform activities, for example, approval, special case dealing with, internationalization, showing middle of the road result etc.

Advantage of interceptors

Pluggable If we have to expel any worry, for example, approval, exemption dealing with, logging and so forth from the application, we don't have to redeploy the application. We just need to expel the section from the struts.xml file.

Struts 2 default interceptors

There are numerous interceptors given by struts 2 structure. We have alternative to make our own interceptors. The struts 2 default interceptors are as per the following:

1) alias It changes over comparable parameters that have distinctive names between requests.

2) autowiring

3) chain If it is utilized with chain result type, it makes the properties of past activity accessible in the current action.

4) checkbox It is utilized to deal with the check encloses the structure. By this, we can distinguish the unchecked checkboxes.

5) cookie It adds a treat to the current action.

6) conversionError It adds transformation blunders to the activity's field errors.

7) createSession It makes and HttpSession object in the event that it doesn't exists.

8) clearSession It unbinds the HttpSession object.

9) debugging It offers help of debugging.

10) externalRef

11) execAndWait It sends a halfway hanging tight page for the result.

12) exception It maps special case to an outcome.

13) fileUpload It offers help to document transfer in struts 2.

14) i18n It offers help to internationalization and localization.

15) jsonValidation It offers help to nonconcurrent validation.

16) logger It yields the activity name.

17) store It stores and recovers activity messages, activity mistakes or field blunders for activity that actualizes ValidationAware interface.

18) modelDriven It makes other model article as the default object of valuestack.

19) scopedModelDriven It is like ModelDriven however works for activity that executes ScopedModelDriven.

20) params It populates the activity properties with the solicitation parameters.

21) actionMappingParams

22) prepare It performs arrangement rationale if activity executes Preparable interface.

23) profiling It underpins activity profiling.

24) roles It underpins job based action.

25) scope It is utilized to store the activity state in the session or application scope.

26) servletConfig It gives access to maps speaking to HttpServletRequest and HttpServletResponse.

27) sessionAutowiring

28) staticParams It maps static properties to activity properties.

29) timer It yields the time expected to execute an action.

30) token It averts duplication accommodation of request.

31) tokenSession It averts duplication accommodation of request.

32) validation It offers help to enter validation.

33) workflow It calls the approve strategy for activity class if activity class executes Validateable interface.

34) annotationWorkflow

35) multiselect

javacodegeeks is optimized for learning.© javacodegeeks .
All Right Reserved and you agree to have read and accepted our term and condition