org.springframework.web.servlet.tags.form

Class OptionTag

  • All Implemented Interfaces:
    java.io.Serializable, BodyTag, DynamicAttributes, IterationTag, JspTag, Tag, TryCatchFinally, EditorAwareTag


    public class OptionTag
    extends AbstractHtmlElementBodyTag
    implements BodyTag
    The <option> tag renders a single HTML 'option'. Sets 'selected' as appropriate based on bound value.

    Must be used nested inside a SelectTag.

    Provides full support for databinding by marking an 'option' as 'selected' if the value matches the value bound to the out SelectTag.

    The value property is required and corresponds to the 'value' attribute of the rendered 'option'.

    An optional label property can be specified, the value of which corresponds to inner text of the rendered 'option' tag. If no label is specified then the value property will be used when rendering the inner text.

    Attribute Summary
    Attribute Required? Runtime Expression? Description

    cssClass

    false

    true

    HTML Optional Attribute

    cssErrorClass

    false

    true

    HTML Optional Attribute. Used when the bound field has errors.

    cssStyle

    false

    true

    HTML Optional Attribute

    dir

    false

    true

    HTML Standard Attribute

    disabled

    false

    true

    HTML Optional Attribute. Setting the value of this attribute to 'true' will disable the HTML element.

    htmlEscape

    false

    true

    Enable/disable HTML escaping of rendered values.

    id

    false

    true

    HTML Standard Attribute

    label

    false

    true

    HTML Optional Attribute

    lang

    false

    true

    HTML Standard Attribute

    onclick

    false

    true

    HTML Event Attribute

    ondblclick

    false

    true

    HTML Event Attribute

    onkeydown

    false

    true

    HTML Event Attribute

    onkeypress

    false

    true

    HTML Event Attribute

    onkeyup

    false

    true

    HTML Event Attribute

    onmousedown

    false

    true

    HTML Event Attribute

    onmousemove

    false

    true

    HTML Event Attribute

    onmouseout

    false

    true

    HTML Event Attribute

    onmouseover

    false

    true

    HTML Event Attribute

    onmouseup

    false

    true

    HTML Event Attribute

    tabindex

    false

    true

    HTML Standard Attribute

    title

    false

    true

    HTML Standard Attribute

    value

    true

    true

    HTML Optional Attribute

    Since:
    2.0
    Author:
    Rob Harrop, Juergen Hoeller
    See Also:
    Serialized Form