com.opensymphony.xwork2.interceptor

## Class ParameterRemoverInterceptor

- java.lang.Object
- - org.apache.struts2.interceptor.AbstractInterceptor
  - - com.opensymphony.xwork2.interceptor.AbstractInterceptor
    - - com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor

- All Implemented Interfaces:
    Serializable, ConditionalInterceptor, Interceptor

  Deprecated.
  since 6.7.0, use `ParameterRemoverInterceptor` instead.

      @Deprecated
      public class ParameterRemoverInterceptor
      extends AbstractInterceptor

  This is a simple XWork interceptor that allows parameters (matching one of the paramNames attribute csv value) to be removed from the parameter map if they match a certain value (matching one of the paramValues attribute csv value), before they are set on the action. A typical usage would be to want a dropdown/select to map onto a boolean value on an action. The select had the options none, yes and no with values -1, true and false. The true and false would map across correctly. However the -1 would be set to false. This was not desired as one might needed the value on the action to stay null. This interceptor fixes this by preventing the parameter from ever reaching the action.
  - paramNames - A comma separated value (csv) indicating the parameter name whose param value should be considered that if they match any of the comma separated value (csv) from paramValues attribute, shall be removed from the parameter map such that they will not be applied to the action
  - paramValues - A comma separated value (csv) indicating the parameter value that if matched shall have its parameter be removed from the parameter map such that they will not be applied to the action

  No intended extension point

       <action name="sample" class="org.martingilday.Sample">
              <interceptor-ref name="paramRemover">
                <param name="paramNames">aParam,anotherParam</param>
                <param name="paramValues">--,-1</param>
              </interceptor-ref>
              <interceptor-ref name="defaultStack" />
              ...
       </action>

  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.opensymphony.xwork2.interceptor.ConditionalInterceptor

      `ConditionalInterceptor.LegacyAdapter`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParameterRemoverInterceptor()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `intercept(ActionInvocation invocation)` Deprecated. Decide if the parameter should be removed from the parameter map based on `paramNames` and `paramValues`.
    `void` | `setParamNames(String paramNames)` Deprecated. Allows `paramNames` attribute to be set as comma-separated-values (csv).
    `void` | `setParamValues(String paramValues)` Deprecated. Allows `paramValues` attribute to be set as a comma-separated-values (csv).

    - ### Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor

      `intercept, shouldIntercept, shouldIntercept`

    - ### Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptor

      `destroy, init, setDisabled`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.opensymphony.xwork2.interceptor.ConditionalInterceptor

      `adapt`

    - ### Methods inherited from interface com.opensymphony.xwork2.interceptor.Interceptor

      `adapt`

    - ### Methods inherited from interface org.apache.struts2.interceptor.Interceptor

      `destroy, init`

- - ### Constructor Detail

    - #### ParameterRemoverInterceptor

          public ParameterRemoverInterceptor()

      Deprecated.

  - ### Method Detail

    - #### intercept

          public String intercept(ActionInvocation invocation)
                           throws Exception

      Deprecated.
      Decide if the parameter should be removed from the parameter map based on `paramNames` and `paramValues`.
      Specified by:
        `intercept` in class `AbstractInterceptor`
      Throws:
        `Exception`
      See Also:
        `AbstractInterceptor`

    - #### setParamNames

          public void setParamNames(String paramNames)

      Deprecated.
      Allows `paramNames` attribute to be set as comma-separated-values (csv).
      Parameters:
        `paramNames` - the paramNames to set

    - #### setParamValues

          public void setParamValues(String paramValues)

      Deprecated.
      Allows `paramValues` attribute to be set as a comma-separated-values (csv).
      Parameters:
        `paramValues` - the paramValues to set

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.