Class AbstractMultiCheckedElementTag

All Implemented Interfaces:
DynamicAttributes, IterationTag, JspTag, Tag, TryCatchFinally, Serializable, EditorAwareTag
Direct Known Subclasses:
CheckboxesTag, RadioButtonsTag

public abstract class AbstractMultiCheckedElementTag extends AbstractCheckedElementTag
Abstract base class to provide common methods for implementing databinding-aware JSP tags for rendering multiple HTML 'input' elements with a 'type' of 'checkbox' or 'radio'.
Since:
2.5.2
Author:
Juergen Hoeller, Scott Andrews
See Also:
  • Constructor Details

    • AbstractMultiCheckedElementTag

      public AbstractMultiCheckedElementTag()
  • Method Details

    • setItems

      public void setItems(Object items)
      Set the Collection, Map or array of objects used to generate the 'input type="checkbox/radio"' tags.

      Typically a runtime expression.

      Parameters:
      items - said items
    • getItems

      @Nullable protected Object getItems()
      Get the Collection, Map or array of objects used to generate the 'input type="checkbox/radio"' tags.
    • setItemValue

      public void setItemValue(String itemValue)
      Set the name of the property mapped to the 'value' attribute of the 'input type="checkbox/radio"' tag.

      May be a runtime expression.

    • getItemValue

      @Nullable protected String getItemValue()
      Get the name of the property mapped to the 'value' attribute of the 'input type="checkbox/radio"' tag.
    • setItemLabel

      public void setItemLabel(String itemLabel)
      Set the value to be displayed as part of the 'input type="checkbox/radio"' tag.

      May be a runtime expression.

    • getItemLabel

      @Nullable protected String getItemLabel()
      Get the value to be displayed as part of the 'input type="checkbox/radio"' tag.
    • setDelimiter

      public void setDelimiter(String delimiter)
      Set the delimiter to be used between each 'input type="checkbox/radio"' tag.

      By default, there is no delimiter.

    • getDelimiter

      @Nullable public String getDelimiter()
      Return the delimiter to be used between each 'input type="radio"' tag.
    • setElement

      public void setElement(String element)
      Set the HTML element used to enclose the 'input type="checkbox/radio"' tag.

      Defaults to an HTML '<span/>' tag.

    • getElement

      public String getElement()
      Get the HTML element used to enclose 'input type="checkbox/radio"' tag.
    • resolveId

      protected String resolveId() throws JspException
      Appends a counter to a specified id as well, since we're dealing with multiple HTML elements.
      Overrides:
      resolveId in class AbstractDataBoundFormElementTag
      Throws:
      JspException
      See Also:
    • writeTagContent

      protected int writeTagContent(TagWriter tagWriter) throws JspException
      Renders the 'input type="radio"' element with the configured setItems(Object) values. Marks the element as checked if the value matches the bound value.
      Specified by:
      writeTagContent in class AbstractCheckedElementTag
      Returns:
      valid tag render instruction as per Tag.doStartTag().
      Throws:
      JspException