Tag Library Descriptor File
We sometimes refer to the tag library descriptor file as a TLD file or .tld file, after its conventional file extension. This XML file contains information for the JSP container about a set of tags that can appear in the JSP. To be a TLD file, an XML file needs to have the right DOCTYPE declaration at the beginning, after the usual XML declaration, as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
The root of the TLD XML document is a taglib element. It contains child elements to contain the versions of the tag library and the minimum JSP version it requires. There are also elements for a short name, a URI, and an "info" string for the tag library. Also in the XML, and the reason for its existence, are tag elements for each JSP custom action in the library.
The tag elements contain different types of elements to describe aspects of each action tag, including its name, its Tag Handler class, information about what the tag body can contain, information about any attributes it uses, and more. One way to get the whole picture in an official way, is to look at the DTD defining the JavaServer Pages 1.1 tag library descriptor (XML) file. We found a copy of it in the file TOMCAT_HOME\src\org\apache\jasper\resources\web-jsptaglib_1_1.dtd.