Tag library descriptor references

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 follows in a JSP:

<%@ taglib uri="/example.tld" prefix="ex" %>

This path can be mapped 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 provides several benefits such as:

In an XML deployment descriptor, TLD URL mappings are specified by taglib elements.

NoteTag library classes A Web application’s tag library classes must be deployed in 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.

StepsConfiguring TLD mappings in EAServer Manager

  1. Display the Advanced tab in the Web Application Properties dialog box.

  2. If necessary, add an entry for the property com.sybase.jaguar.webapplication.taglib. Otherwise, modify the existing value for this property.

  3. In the property value, specify each mapping as follows:

    (taglib-uri=alias, taglib-location=real-path)
    

    Where alias is the path used in JSP source code, and real-path is the TLD file’s location relative to the Web application’s context root.

    If multiple mappings are required, separate each by a comma. For example (the following must be entered without line breaks or carriage returns):

    (taglib-uri=taglib.tld, taglib-location=TLD/abctaglib.tld),
    (taglib-uri=lib2.tld,taglib-location=TLD/lib2v2.tld)