Home > Guides > Core Developers Guide > Interceptors > Parameters Interceptor
Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

For more information on ways to restrict the parameter names allowed, see the ParameterNameAware javadocs:

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Parameters

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Excluding parameters

This interceptor can be forced to ignore parameters, by setting its excludeParams attribute. This attribute accepts a comma separated list of regular expressions. When any of these expressions match the name of a parameter, such parameter will be ignored by the interceptor. Interceptor stacks defined by Struts already exclude some parameters:

Default List of Parameters Excluded

dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*

Below is an example of adding a parameter named submit to the list of parameters that should be excluded.

Setup Interceptor Stack To Exclude submit Parameter


<interceptors>
  <interceptor-stack name="appDefault">
    <interceptor-ref name="defaultStack">
       <param name="exception.logEnabled">true</param>
       <param name="exception.logLevel">ERROR</param>
       <param name="params.excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*,submit</param>
    </interceptor-ref>
  </interceptor-stack>
</interceptors>
		
<default-interceptor-ref name="appDefault" />

Extending the Interceptor

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Warning on missing parameters

When there is no setter for given parameter name, a warning message like below will be logged in devMode:

SEVERE: Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'search' on 'class demo.ItemSearchAction: Error setting expression 'search' with value ['search', ]
Error setting expression 'search' with value ['search', ] - [unknown location]
	at com.opensymphony.xwork2.ognl.OgnlValueStack.handleRuntimeException(OgnlValueStack.java:201)
	at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:178)
	at com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:152)

Thus is expected behaviour to allow developer to spot missing setter or typo in either parameter name or setter.

Examples

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20