• Interceptor is used for seperation of core functionality code in the form of Interceptors makes Action more lightweight.
  • The purpose of Interceptors is to allow greater control over controller layer and separate some common logic that applies to multiple actions.
  • All framework interceptors defined in struts-default.xml

Alias Interceptor

  • This interceptor alias a named parameter to a different parameter name.
  • Suppose your jsp having two textfield name t1 and t2 and in your action class you defined t3 and t4 variable , so alias interceptor can map t1 with t3 alias and t2 with t4 alias.
Entry in Alias.jsp file

Entry in file

Entry in Struts.xml file

Entry in Application Resources property file

Entry in Struts property file

Execute and Wait

  • While running a long action, the user may get impatient in case of a long delay in response.
  • To avoid this, the exec And Wait Interceptor is used, which runs a long running action in the background and display a page with a Loading to the user.
Entry in Index.jsp file

Entry of Execute method in LoginAction class file

Entry Wait.jsp file

Entry in Struts.xml file