JSP.5.2 Tag Library


A tag library is a collection of actions that encapsulate some functionality to be used from within a JSP page. A tag library is made available to a JSP page via a taglib directive that identifies the tag library via a URI (universal resource identifier).

The URI identifying a tag library may be any valid URI as long as it can be used to uniquely identify the semantics of the tag library. A common mechanism is to encode the version of a tag library into its URI.

The URI identifying the tag library is associated with a tag library description (TLD) file and with tag handler classes as indicated in Section JSP.5.3 below.

JSP.5.2.1 Packaged Tag Libraries

JSP page authoring tools are required to accept a tag library that is packaged as a JAR file. When packaged so, the JAR file must have a tag library descriptor file named META-INF/taglib.tld.

JSP.5.2.2 Location of Java Classes

The request-time Tag handler classes and the translation-time TagExtraInfo classes are just Java classes. In a web application they must reside in the standard locations for Java classes: either in a JAR file in the WEB-INF/lib directory or in a directory in the WEB-INF/classes directory.

The previous rule indicates that a JAR containing packaged tag libraries can be dropped into the WEB-INF/lib directory to make its classes available at request time (and also at translation time, see Section JSP.5.3.2). The mapping between the URI and the TLD is explained further below.

JSP.5.2.3 Tag Library Directive

The taglib directive in a JSP page declares that the page uses a tag library, uniquely identifies the tag library using a URI , and associates a tag prefix that will distinguish usage of the actions in the library.

If a JSP container implementation cannot locate (following the rules described in Section JSP.5.3.1) a tag library description for a given URI, a fatal translation error shall result.

It is a fatal translation error for the taglib directive to appear after actions using the prefix introduced by the taglib directive.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net