Custom JSP tag. Lets you create HTML select control. For example:
You may obtain options through some array (collection, iterator etc.) and use this object for
building your control:
In this example (our collection contains Strings) tag iterates over elements and creates the control. You can pass a collection of beans also and describe how to get the value and text for options. Attribute option specifies what getXXX method is called on each item in your source for getting options. Attribute value does the same for values. E.g. option="name" means that that getName() call is used for getting options etc.
Tags are:
select
Body tag. Creates HTML select control. Parameters are:
1) name Describes a name for your control
2) size Optional parameter. Defines how many elements are visible.
Default value is 1
3) multiple Optional parameter. Enables/disables multiple selection. Possible values
are true or false. Default value is false (disabled).
4) id Optional parameter. Defines a CSS/XHTML id
5) className Optional parameter. Defines a CSS class name
6) style Optional parameter. Defines a CSS style
7) source Optional parameter. Describes collection, iterator, enumeration or array
with elements (options) for selection.
8) option Optional parameter. Describes a name for property used for getting options
9) value Optional parameter. Describes a name for property used for getting values
10) autoSubmit Optional parameter. Enables/disables form submission after selection. Possible values
are true or false. Default value is false (disabled).
11) disabled Optional parameter. Enables/disables this control. Possible values
are true or false. Default value is false (enabled).
12) onChange Optional parameter. Describes your own JavaScript code to be called after the selection.
option
Body tag. Describes an option for your control (as tag's body). Parameters are:
1) value Optional parameter. Describes a value for this option.
2) selected Optional parameter. Defines a current status for this option.
Possible values are true or false. Default value is false (not selected).
selectedIndex
Body tag lets you set an index for the selected element. Tag's body presents an index (starting from 1) for option. Option's state will be set to selected. Parameters are: none
selectedValue
Body tag lets you set a value for the selected element. Tag's body presents a value for option. Option's state will be set to selected. Parameters are: none
for downloading:
Library: seltag.jar Description: taglib.tld
See also Coldtags suite - the largest collection of custom JSP tags.