Sorted list taglib ver. 1.3

    Custom JSP tag. Lets you create HTML select control with sorting buttons. So you will be able to change order for elements in your list.

For example:

<%@ taglib uri="taglib.tld" prefix="sel" %>

<form method=post action=your_page.jsp>
<sel:sortedList style="width:90px" name="s1">
   <sel:option value="1">Java</sel:option>
   <sel:option value="2">C#</sel:option>
   <sel:option value="3">PHP</sel:option>
   <sel:option value="4">Perl</sel:option>

And you will get some like this:

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();

<sel:sortedList name="s1" 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:


Body tag. Creates select control with sorting functionality. Parameters are:

1) name name for element
2) size Optional parameter. Defines how many elements are visible. Default value is 5
3) id Optional parameter. Defines a CSS/XHTML id
4) className Optional parameter. Defines a CSS class name
5) style Optional parameter. Defines a CSS style
6) source Optional parameter. Describes collection, iterator, enumeration or array with elements (options) for selection.
7) option Optional parameter. Describes a name for property used for getting options
8) value Optional parameter. Describes a name for property used for getting values


Body tag. Describes an option for your select control (as tag's body). Parameters are:

1) value Optional parameter. Describes a value for this option.

for downloading:

    Library: sortedtag.jar    Description: taglib.tld

 © Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.