Javatpoint Logo
Javatpoint Logo

Struts 2 params interceptor example

The params interceptor also known as parameters interceptor is used to set all parameters on the valuestack.

It is found in the default stack bydefault. So you don't need to specify it explicitely.

Internal working of params interceptor

It gets all parameters by calling the getParameters() method of ActionContext and sets it on the valuestack by calling the setValue() method of ValueStack.

Parameters of params interceptor

There are 4 parameters defined for params interceptor.

ParameterDescription
orderedIt is true bydefault but can be used to top-down the property setter behaviour.
paramNameMaxLengthspecifies the maximum length for the parameter. The default length is 100 characters bydefault. The parameters length more that 100 will be ignored.
excludeParams specifies the unallowed parameter names. You can specify multiple names separated with comma.
acceptParamNames specifies the accepted parameter names.

Example of params interceptor

Let's see the simple example of params interceptor.

Note: If you specify any interceptor for the action explicitely, default interceptors will not be available for the action class.


Struts 2 defaultStack interceptors

The params interceptor is found in the default stack. You don't need to specify interceptors found in the default-stack. The defaultStack interceptors are as follows:





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA