Stripes Tag Library
Tag options-collection


Writes a set of <option value="foo">bar</option> tags to the page based on the contents of a Collection, Iterable or Array. Each element in the collection is represented by a single option tag on the page. Uses the label and value attributes on the tag to name the properties of the objects in the Collection that should be used to generate the body of the HTML option tag and the value attribute of the HTML option tag respectively. If either (or both) of the label or value properties are ommitted the item itself will be used for the label/value instead - this is done to support collections of simple types like Strings and Numbers.

E.g. a tag declaration that looks like:

<stripes:options-collection collection="${cats}" value="catId" label="name"/>

would cause the container to look for a Collection called "cats" across the various JSP scopes and set it on the tag. The tag would then proceed to iterate through that collection calling getCatId() and getName() on each cat to produce HTML option tags.

The tag will attempt to localize the labels attributes of the option tags that are generated. To do this it will look up labels in the field resource bundle using:

For example for a class com.myco.Gender supplied to the options-collection tag with label="description" and value="key", when rendering for an instance Gender[key="M", description="Male"] the following localized properites will be looked for:

If no localized label can be found then the value of the label property will be used.

Optionally, the group attribute may be used to generate <optgroup> tags. The value of this attribute is used to retrieve the corresponding property on each object of the collection. A new optgroup will be created each time the value changes.

The rendered group may be localized by specifying one of the following properties:

All other attributes on the tag (other than collection, value, label and group) are passed directly directly through to the stripes:option tag which is used to generate the individual HTML options tags. As a result the stripes:options-collection will exhibit the same re-population/selection behaviour as the regular options tag.

Since the tag has no use for one it does not allow a body.



Tag Information
Tag Classnet.sourceforge.stripes.tag.InputOptionsCollectionTag
TagExtraInfo ClassNone
Body Contentempty
Display Nameoptions-collection

Attributes
NameRequiredRequest-timeTypeDescription
valuefalsetruejava.lang.String The name of the property (of the beans in the collection) that should be used to generate the value of each option (i.e. the value that is sent to the server).
labelfalsetruejava.lang.String The name of the property (of the beans in the collection) that should be used to generate the label of each option (i.e. the text displayed to the user).
sortfalsetruejava.lang.String A comma separated list of bean properties by which the collection should be sorted before rendering the options. Special values of 'label' and 'value' indicate that the options should be sorted by the label and value respectively - even when using localized or derived values.
collectiontruetruejava.lang.Object The 'collection' of beans to use to generate options. This value must resolve to one of the following: a real java.util.Collection, an instance of java.lang.Iterable or an array. It will therefore most often be an EL expression (or a scriptlet, if you must).
groupfalsetruejava.lang.String The name of the property which will be used to generate <optgroup> tags. Each time a new value is encountered an optgroup will be written for it.
accesskeyfalsetruejava.lang.StringKeyboard shortcut to access the element. (HTML Pass-through)
classfalsetruejava.lang.StringThe CSS class to be applied to the element. (HTML Pass-through)
dirfalsetruejava.lang.StringText direction. (HTML Pass-through)
idfalsetruejava.lang.StringA unique identifier for the HTML tag on the page. (HTML Pass-through)
langfalsetruejava.lang.StringThe language code of the element. (HTML Pass-through)
onblurfalsetruejava.lang.StringScripting code run when the element loses focus. (HTML Pass-through)
onchangefalsetruejava.lang.StringScripting code run when the element changes. (HTML Pass-through)
onclickfalsetruejava.lang.StringScripting code run on each mouse click. (HTML Pass-through)
ondblclickfalsetruejava.lang.StringScripting code run on a double-click of the mouse. (HTML Pass-through)
onfocusfalsetruejava.lang.StringScripting code run when the element acquires focus. (HTML Pass-through)
onkeydownfalsetruejava.lang.StringScripting code run when a key is depressed. (HTML Pass-through)
onkeypressfalsetruejava.lang.StringScripting code run when a key is pressed and released. (HTML Pass-through)
onkeyupfalsetruejava.lang.StringScripting code run when a key is released. (HTML Pass-through)
onmousedownfalsetruejava.lang.StringScripting code run when a mouse button is depressed. (HTML Pass-through)
onmousemovefalsetruejava.lang.StringScripting code run when the mouse pointer is moved. (HTML Pass-through)
onmouseoutfalsetruejava.lang.StringScripting code run when the mouse pointer moves out of the element. (HTML Pass-through)
onmouseoverfalsetruejava.lang.StringScripting code run when the mouse pointer moves over the element. (HTML Pass-through)
onmouseupfalsetruejava.lang.StringScripting code run when a mouse button is released. (HTML Pass-through)
onselectfalsetruejava.lang.StringScripting code run when an element is selected. (HTML Pass-through)
stylefalsetruejava.lang.StringInline CSS style fragment that applies to the element (HTML Pass-through)
tabindexfalsetruejava.lang.StringThe tab order of the element. (HTML Pass-through)
titlefalsetruejava.lang.StringTool-tip text for the element. (HTML Pass-through)

Variables
No Variables Defined.


Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.