List properties taglib ver. 1.4


    Custom JSP taglib. This taglib lets you build web controls from properties files. Tag listProperties reads properties file and displays all the elements as a dropdown list (group of checkboxes or radio buttons). For example, suppose you have the following data in your test.ini file:
 


key1=option 1
key2=option 2
etc.

then the following code displays a drop down list for available options:
 


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

<ini:listPropeties name="list" file="test.ini" control="dropdown"/>

and you will get some like this:

Body tag setSelected lets you define a selected option. Tag's body describes a key for selected element. E.g.:
 


<ini:listPropeties name="list" file="test.ini" control="dropdown">
  <ini:setSelected>key2</ini:setSelected>
</ini:listProperties>

You can use check boxes (or radio buttons) instead of the drop down list. For example:
 


<ini:listPropeties name="list" file="test.ini" control="radio">
  <ini:setSelected>key2</ini:setSelected>
</ini:listProperties>

and you will get some like this:

Option 1  Option 2

You can read localized values also. In this case you have to provide a base name for your properties files. For example:
 


<ini:listPropeties name="list" baseName="test" control="dropdown"/>

in this example tag points to files in CLASSPATH (e.g. in WEB-INF/classes) with names like test_en.properties, test_en_US.properties, test_fr.properties etc. depends on the locale.

Tags are:

listProperties

Displays HTML control from the given properties file. Parameters are:

1) name Describes a name for your control
2) file Optional parameter. Describes a name for your file
3) baseName Optional parameter. Describes a base name for properties files
4) locale Optional parameter. Describes a locale for your bundle. Without this parameter tag will use the locale from browser preferences.
5) keyStarts Optional parameter. Describes a pattern for the keys. Without this parameter tag will use all the keys from your file.
6) control Optional parameter. Describes a type for your control. Possible values are dropdown, radio, check. Default value is dropdown.
7) direction Optional parameter. Describes how to output radio buttons or check boxes. Possible values are horizontal or vertical. Default value is horizontal.
8) autoSubmit Optional parameter. Possible values are true and false. Enables/disables form submission after selection. Default value is false (disabled).
9) order Optional parameter. Lets you sort options. Possible values are asc or desc.

setSelected

Body tag describes a key for the selected (checked) element. Parameters are: none

for downloading:

Library: listprop.jar    Description: taglib.tld

© Coldbeans      Comments?

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

Also in Coldtags: