Renders a set of HTML <option>
elements,
representing possible choices for a <select>
element. This tag can be used multiple times within a single
<html:select>
element, either in conjunction
with or instead of one or more <html:option>
or <html:optionsCollection>
elements.
This tag operates in one of two major modes, depending on
whether or not the collection
attribute is
specified. If the collection
attribute is
included, the following rules apply:
labelProperty
attribute is not specified, the
property named by the property
attribute will
be used to select both the value returned to the server and
the label displayed to the user for this option.If the collection
attribute is not specified,
the rules described in the remainder of this section apply.
The collection of values actually selected depends on the presence or
absence of the name
and property
attributes. The
following combinations are allowed:
name
is specified - The value of this attribute
is the name of a JSP bean in some scope that is the
collection.property
is specified - The value of this
attribute is the name of a property of the ActionForm bean associated
with our form, which will return the collection.name
and property
are specified -
The value of the name
attribute identifies a JSP bean
in some scope. The value of the property
attribute is the
name of some property of that bean which will return the collection.The collection of labels displayed to the user can be the same as the
option values themselves, or can be different, depending on the presence or
absence of the labelName
and labelProperty
attributes. If this feature is used, the collection of labels must contain
the same number of elements as the corresponding collection of values.
The following combinations are allowed:
labelName
nor labelProperty
is
specified - The labels will be the same as the option values
themselves.labelName
is specified - The value of this
attribute is the name of a JSP bean in some scope that is the
collection.labelProperty
is specified - The value of this
attribute is the name of a property of the ActionForm bean associated
with our form, which will return the collection.labelName
and labelProperty
are
specified - The value of the labelName
attribute
identifies a JSP bean in some scope. The value of the
labelProperty
attribute is the name of some property of
that bean which will return the collection.Note that this tag does not support a styleId
attribute, as it would have to apply the value to all the
option
elements created by this element, which would
mean that more than one id
element might have the same
value, which the HTML specification says is illegal.