Custom JSP tag. Lets you create HTML select control. For example:
<%@ taglib uri="taglib.tld" prefix="sel" %> <form method=post action=your_page.jsp> ... <sel:select autoSubmit="true" size="1"> <sel:option value="1">Java</sel:option> <sel:option value="2">C#</sel:option> </sel:select> ... </form> You may obtain options through some array (collection, iterator etc.) and use this object for
building your control:
<% java.util.Vector v=new java.util.Vector(); v.addElement("Java"); ... %> <sel:select source="<%=v%>" /> 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
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.
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: 1) cond Optional parameter. Describes a boolean value tag's behavior depends on. Default value is true (set index). 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: 1) cond Optional parameter. Describes a boolean value tag's behavior depends on. Default value is true (set value). selectedOption Body tag lets you set selected option. Tag's body presents your option. Option's state will be set to selected. Parameters are: 1) cond Optional parameter. Describes a boolean value tag's behavior depends on. Default value is true (set value). for downloading: Library: seltag.jar Description: taglib.tld See also Coldtags suite - the largest collection of custom JSP tags. |
Also in Coldtags:
|