Home » xwork-2.1.5 » com.opensymphony » xwork2 » interceptor » [javadoc | source]
public class: ParameterRemoverInterceptor [javadoc | source]

All Implemented Interfaces:

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. 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 name="defaultStack" />

Method from com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor Summary:
intercept,   setParamNames,   setParamValues
Methods from com.opensymphony.xwork2.interceptor.AbstractInterceptor:
destroy,   init,   intercept
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor Detail:
 public String intercept(ActionInvocation invocation) throws Exception 
    Decide if the parameter should be removed from the parameter map based on paramNames and paramValues.
 public  void setParamNames(String paramNames) 
    Allows paramNames attribute to be set as comma-separated-values (csv).
 public  void setParamValues(String paramValues) 
    Allows paramValues attribute to be set as a comma-separated-values (csv).