O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required