Packaging and Installing a Tag

When you create a custom tag library you must also create a Tag Library Descriptor (TLD) that describes each tag in your tag library. Listing 16.19 shows the TLD for the HelloWorldTag Java class.

Code Listing 16.19. Source Code for hello.tld
<?xml version="1.0"?>
<!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

<taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>hello</shortname>
    <uri></uri>
    <info>
        An example Hello World tag
    </info>

    <tag>
        <name>hello</name>
        <tagclass>HelloWorldTag</tagclass>
    </tag>
</taglib>
					

The first few lines of hello.tld are pretty standard for an XML file. You must start ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.