Class CheckboxInterceptor

java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.CheckboxInterceptor
All Implemented Interfaces:
Serializable, ConditionalInterceptor, Interceptor

public class CheckboxInterceptor extends AbstractInterceptor

Looks for a hidden identification field that specifies the original value of the checkbox. If the checkbox isn't submitted, insert it into the parameters as if it was with the value of 'false'.

  • setUncheckedValue - The default value of an unchecked box can be overridden by setting the 'uncheckedValue' property.

See Also:
  • Constructor Details

    • CheckboxInterceptor

      public CheckboxInterceptor()
  • Method Details

    • intercept

      public String intercept(ActionInvocation ai) throws Exception
      Description copied from class: AbstractInterceptor
      Override to handle interception
      Specified by:
      intercept in interface Interceptor
      Specified by:
      intercept in class AbstractInterceptor
      Parameters:
      ai - the action invocation
      Returns:
      the return code, either returned from ActionInvocation.invoke(), or from the interceptor itself.
      Throws:
      Exception - any system-level error, as defined in Action.execute().
    • setUncheckedValue

      public void setUncheckedValue(String uncheckedValue)
      Overrides the default value for an unchecked checkbox
      Parameters:
      uncheckedValue - The uncheckedValue to set
    • setHiddenPrefix

      public void setHiddenPrefix(String hiddenPrefix)
      Sets the prefix used for hidden checkbox fields. Default is "__checkbox_" for backward compatibility.
      Parameters:
      hiddenPrefix - The prefix to use for hidden checkbox fields
      Since:
      7.2.0