public class

SelectTag

extends AbstractHtmlInputElementTag
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.SelectTag

Class Overview

Databinding-aware JSP tag that renders an HTML 'select' element.

Inner 'option' tags can be rendered using one of the approaches supported by the OptionWriter class.

Also supports the use of nested OptionTags or (typically one) nested OptionsTag.

See Also

Summary

Constants
String LIST_VALUE_PAGE_ATTRIBUTE The javax.servlet.jsp.PageContext attribute under which the bound value is exposed to inner OptionTags.
[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
SelectTag()
Public Methods
int doEndTag()
Closes any block tag that might have been opened when using nested options.
void doFinally()
Clears the TagWriter that might have been left over when using nested options.
void setItemLabel(String itemLabel)
Set the name of the property mapped to the label (inner text) of the 'option' tag.
void setItemValue(String itemValue)
Set the name of the property mapped to the 'value' attribute of the 'option' tag.
void setItems(Object items)
Set the Collection, Map or array of objects used to generate the inner 'option' tags.
void setMultiple(Object multiple)
Set the value of the HTML 'multiple' attribute rendered on the final 'select' element.
void setSize(String size)
Set the value of the HTML 'size' attribute rendered on the final 'select' element.
Protected Methods
String getItemLabel()
Get the value of the 'itemLabel' attribute.
String getItemValue()
Get the value of the 'itemValue' attribute.
Object getItems()
Get the value of the 'items' attribute.
Object getMultiple()
Get the value of the HTML 'multiple' attribute rendered on the final 'select' element.
String getSize()
Get the value of the 'size' attribute.
int writeTagContent(TagWriter tagWriter)
Renders the HTML 'select' tag to the supplied TagWriter.
[Expand]
Inherited Methods
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

Constants

public static final String LIST_VALUE_PAGE_ATTRIBUTE

The javax.servlet.jsp.PageContext attribute under which the bound value is exposed to inner OptionTags.

Constant Value: "org.springframework.web.servlet.tags.form.SelectTag.listValue"

Public Constructors

public SelectTag ()

Public Methods

public int doEndTag ()

Closes any block tag that might have been opened when using nested options.

Throws
JspException

public void doFinally ()

Clears the TagWriter that might have been left over when using nested options.

public void setItemLabel (String itemLabel)

Set the name of the property mapped to the label (inner text) of the 'option' tag.

May be a runtime expression.

public void setItemValue (String itemValue)

Set the name of the property mapped to the 'value' attribute of the 'option' tag.

Required when wishing to render 'option' tags from an array or Collection.

May be a runtime expression.

public void setItems (Object items)

Set the Collection, Map or array of objects used to generate the inner 'option' tags.

Required when wishing to render 'option' tags from an array, Collection or Map.

Typically a runtime expression.

Parameters
items the items that comprise the options of this selection

public void setMultiple (Object multiple)

Set the value of the HTML 'multiple' attribute rendered on the final 'select' element.

May be a runtime expression.

public void setSize (String size)

Set the value of the HTML 'size' attribute rendered on the final 'select' element.

May be a runtime expression.

Parameters
size the desired value of the 'size' attribute

Protected Methods

protected String getItemLabel ()

Get the value of the 'itemLabel' attribute.

May be a runtime expression.

protected String getItemValue ()

Get the value of the 'itemValue' attribute.

May be a runtime expression.

protected Object getItems ()

Get the value of the 'items' attribute.

May be a runtime expression.

protected Object getMultiple ()

Get the value of the HTML 'multiple' attribute rendered on the final 'select' element.

May be a runtime expression.

protected String getSize ()

Get the value of the 'size' attribute.

May be a runtime expression.

protected int writeTagContent (TagWriter tagWriter)

Renders the HTML 'select' tag to the supplied TagWriter.

Renders nested 'option' tags if the items property is set, otherwise exposes the bound value for the nested OptionTags.

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