JSP CUSTOM TAG LIBRARIES


Incorporating JSPs
To access the functionality of custom JSP tags, you must incorporate:
Incorporating the tag library in a JSP

A JSP author tells the Java parser where to find the Tag Library Descriptor file using a taglib directive. The following taglib directives, when included in a JSP page, indicate that tag libraries exist and where they are located:


This code tells the JSP engine how to parse a page before it compiles it into a servlet. Note that the taglib directives have the following two parameters:

1. uri: specifies name and location of the TLD file
This can be either an absolute or relative URL that refers to the TLD.

2. prefix: indicates the namespace to assign to the library
You then use this namespace in front of the tag names of tag elements defined in the TLD. The default namespaces for the domtags.tld and domutil.tld libraries are
domino and domutil respectively. Using the defaults, you would refer to the session tag as domino:session and the switch tag as domutil:switch. You can define any word to be the prefix for the tags as long as you consistently use that prefix in your code to refer to them.

Incorporating individual JSP tags in a page

JSP tags are defined in the TLD using the Extensible Markup Language (XML) format. Each tag element includes a set of attributes within its opening and closing tags. The tag element represents a Domino object; its attributes further define the object by qualifying what information it should share about itself with the JSP page.

To include a tag:

1. In the HTML editor, after the page directives and opening <HTML> and <BODY> tags, enter the opening angle bracket of a tag(<), followed by the namespace for the TLD containing the custom tag you want to specify (domino or domutil), a colon(:), then the tag name. For example:


2. Enter any attribute values you want to set for the tag by entering the attribute name, followed by the equals (=) sign, then the value you want to set for the attribute, surrounded by quotation marks. For example, to specify the viewname and max attributes, enter:
3. To close the tag: See Also