Introduction
In this article, we will discuss the params Interceptor. But before preceding the params interceptor, let's briefly know what the Struts and Interceptor are.
Struts2 is the combination of the webwork framework of opensymphony and struts 1.
It supports POJO-based actions, Validation Support, AJAX Support, and Integration support to various frameworks such as Hibernate, Spring, Tiles, etc.
Interceptor is an object invoked during the preprocessing and postprocessing of a request.
Params Interceptor
The params Interceptor, also known as parameters Interceptor, is used to set all the parameters on the valuestack. It gives only static values to variables rather than dynamic values.
We didn't need to specify the params interceptor explicitly as it is found in the defaultStack.
Internal working of a params Interceptor
Params interceptor gets all the parameters by calling the getParameters() method of ActionContext and sets it on the valuestack by calling the setValue() method of ValueStack.
Life Cycle of Methods of Params Interceptor
Now. let's discuss the different parameters defined for the params Interceptor.
Parameters of Params Interceptor
So basically, There are four parameters defined for the params Interceptor.
Example
<action name="login" class="com.Coding Ninjas Studio.Login">
<interceptor-ref name="params"/>
<result name="success">login-success.jsp</result>
</action>