JSPs can use tag libraries to serve content formatted with custom tags. The tag library is a Java class with methods to parse content that is tagged with custom tags and output formatted content to be returned in the response stream. Each tag library must have a type library descriptor (TLD) file that describes the available tags and specifies the corresponding Java classes and methods.
JSPs use a type library by specifying the location of the TLD file as a URL. In your Web application, you can specify a mapping so that TLD URLs in JSPs map to a local URL. For example, you may refer to a tag library as:
<%@ taglib uri="/example.tld" prefix="ex" %>
You can also map this path to another location, such as:
/WEB-INF/tlds/PRlibrary_1_4.tld
You do not have to map TLD URLs in the Web application. If there is no mapping that matches a TLD URL, EAServer loads the file at the URL specified in the JSP and raises an error if the file does not exist.
Mapping TLD URLs allows you to:
Keep TLD files together in a common location.
Avoid multiple copies of a TLD when JSPs use different paths to refer to the same type library.
Code JSPs with simple paths, such as tlds/example.tld, while the actual TLD is stored in a versioned directory tree. For example, you can alias tlds/example.tld to WEB-INF/tlds/example/v1.6/example.tld. This allows you to easily test new versions and roll back to previous versions if a problem occurs.
In an XML deployment descriptor, TLD URL mappings are specified by taglib elements.
Tag library classes
A Web application’s tag library classes must be deployed
in either:
The WEB-INF/lib or WEB-INF/classes directories, with the other Java classes required by your Web application. (See “Java classes” for more information) or,
A JAR file containing a tag library in the lib/default/ext subdirectory to make it available to all Web applications.