users@glassfish.java.net

Re: TLDs in Jar files

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 07 Apr 2009 19:47:09 -0700

On 04/ 4/09 03:00 AM, Wolfram Rittmeyer wrote:
> glassfish_at_javadesktop.org wrote:
>> Is it possible to load a tld that is place within any jar file that
>> is included in the classpath of the application?
>> [Message sent by forum member 'obdulin' (obdulin)]
>>
>
> Yes. You have to put the tld-file in the META-INF directory of the
> jar-file. And you should define an <uri> element to ease the mapping
> for the taglib-directive of your JSP.

Actually, according to the JSP spec, JSTL and JSF are the only taglibs that
a Java EE compliant container must consider from a shared location in an
application's
classloader delegation chain.

According to JSP.7.3.2 ("TLD resource path"):

1. If the container is Java EE platform compliant, the Map Entries for
    the tag libraries that are part of the Java EE platform. This currently
    includes the JavaServer Pages Standard Tag Library libraries and the
    JavaServer Faces libraries.
2. Taglib Map in web.xml
3. Implicit Map Entries from TLDs
    - TLDs in JAR files in WEB-INF/lib
    - TLDs under WEB-INF
4. Implicit Map Entries from the Container

Considering any additional taglibs from JAR files in a shared location
would be a
container-specific extension, and apps that depend on it may not be
portable.

Jan