Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

Defining the Custom Component Tag in a Tag Library Descriptor

To define a tag, you need to declare it in a tag library descriptor (TLD), which is an XML document that describes a tag library. A TLD contains information about a library and each tag contained in the library. TLDs are used by a Web container to validate the tags. The set of tags that are part of the HTML render kit are defined in the html_basic TLD.

The custom tags image, area, and map, are defined in components.tld, which is stored in the components/src/components/taglib directory of your installation. The components.tld defines tags for all of the custom components included in this release.

All tag definitions must be nested inside the taglib element in the TLD. Each tag is defined by a tag element. Here is the tag definition of the map tag:

<tag>
  <name>map</name>
  <tag-class>cardemo.MapTag</tag-class>
  <attribute>
    <name>id</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
  </attribute>
  <attribute>
    <name>currentArea</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
  </attribute>
</tag> 

At a minimum, each tag must have a name (the name of the tag) and a tag-class (the tag handler) attribute. For more information on defining tags in a TLD, please consult the Tag Library Descriptors section of this tutorial.

Divider
Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.