public class

CheckboxTag

extends AbstractSingleCheckedElementTag
java.lang.Object
   ↳ TagSupport
     ↳ org.springframework.web.servlet.tags.RequestContextAwareTag
       ↳ org.springframework.web.servlet.tags.HtmlEscapingAwareTag
         ↳ org.springframework.web.servlet.tags.form.AbstractFormTag
           ↳ org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
             ↳ org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
               ↳ org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag
                 ↳ org.springframework.web.servlet.tags.form.AbstractCheckedElementTag
                   ↳ org.springframework.web.servlet.tags.form.AbstractSingleCheckedElementTag
                     ↳ org.springframework.web.servlet.tags.form.CheckboxTag

Class Overview

Databinding-aware JSP tag for rendering an HTML 'input' element with a 'type' of 'checkbox'.

May be used in one of three different approaches depending on the type of the bound value.

Approach One

When the bound value is of type Boolean then the 'input(checkbox)' is marked as 'checked' if the bound value is true. The 'value' attribute corresponds to the resolved value of the value property.

Approach Two

When the bound value is of type Collection then the 'input(checkbox)' is marked as 'checked' if the configured value is present in the bound Collection.

Approach Three

For any other bound value type, the 'input(checkbox)' is marked as 'checked' if the the configured value is equal to the bound value.

Summary

[Expand]
Inherited Constants
From class org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag
From class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
From class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
From class org.springframework.web.servlet.tags.RequestContextAwareTag
[Expand]
Inherited Fields
From class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
From class org.springframework.web.servlet.tags.RequestContextAwareTag
Public Constructors
CheckboxTag()
Protected Methods
int writeTagContent(TagWriter tagWriter)
Renders the 'input(radio)' element with the configured value.
void writeTagDetails(TagWriter tagWriter)
Write the details for the given primary tag: i.e.
[Expand]
Inherited Methods
From class org.springframework.web.servlet.tags.form.AbstractSingleCheckedElementTag
From class org.springframework.web.servlet.tags.form.AbstractCheckedElementTag
From class org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag
From class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
From class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
From class org.springframework.web.servlet.tags.form.AbstractFormTag
From class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
From class org.springframework.web.servlet.tags.RequestContextAwareTag
From class java.lang.Object
From interface org.springframework.web.servlet.tags.EditorAwareTag

Public Constructors

public CheckboxTag ()

Protected Methods

protected int writeTagContent (TagWriter tagWriter)

Renders the 'input(radio)' element with the configured value. Marks the element as checked if the value matches the bound value.

Returns
  • valid tag render instruction as per javax.servlet.jsp.tagext.Tag#doStartTag().
Throws
JspException

protected void writeTagDetails (TagWriter tagWriter)

Write the details for the given primary tag: i.e. special attributes and the tag's value.

Throws
JspException