JSP custom taglib for UI development. This taglib lets you create a text input field
(like a normal HTML input tag) with some associated list of predefined values. So
your users will be able not only type a value but also select it from the some list. And predefined values will be obtained
from your server-side via Ajax call. Tag is similar to our Ajax input taglib.
For example:
<script language="JavaScript" src="cjajax.js"></script> <%@ taglib uri="taglib.tld" prefix="ac" %> Product: <ac:autocomplete name="a" url="getHelp.jsp" listBackground="white"> </ac:autocomplete> and you will get some like this (start typing with J): Tag assumes that your server side returns XML with data for the popup window. E.g.:
<?xml version="1.0" encoding="ISO-8859-1" ?> <ajaxinput> <option>Jdeveloper</option> <option>JBuilder</option> etc. </ajaxinput> Tag will parse the response and fill your popup window with the provided options.
Note: if you are generating XML in JSP file make sure there are no empty lines or white space before the <?xml ... ?> line.
Also in your XML response you can use any name for the root node as well as any names for the nodes. Also you can provide your own CSS styles
for the returned options:
<?xml version="1.0" encoding="ISO-8859-1" ?> <root> <option style="color:green">Jdeveloper</option> <option class="myclass">JBuilder</option> etc. </root> In order to use this tag you have to describe an external JavaScript file cjajax.js on your page. You have to use this tag inside of HTML form (or form taglib from Coldtags suite). Tags are: autocomplete Body tag mimics HTML input tag and requests the predefined values via Ajax. Parameters are: 1) name Describes a name for your input field
for downloading: Library: autocompletetag.jar Description: taglib.tld
See also Coldtags suite - the largest collection of custom JSP tags.
|
Also in Coldtags:
|