You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Keith Hankin <ke...@addr.com> on 2004/06/11 11:02:41 UTC

Jarring custom taglibs: looking for a file named taglib.tld

I have been been trying to jar up a custom taglib java class along with the corresponding tld file. However I keep getting an error indicating that it cannot find a file named "META-INF/taglib.tld".

I have followed instructions in this doc: http://www.ibm.com/developerworks/java/library/j-jsp09023.html?ca=dgr-jw17j-jsp09023 yet it does not seem to work properly.

I created a file myjar.jar with files as follows:

    META-INF/MANIFEST.MF
    META-INF/mytag.tld
    com/mycompany/MyTag.class

I put the jar file into my war file at WEB-INF/lib/myjar.jar

I put the following in web.xml:

  <taglib>

  <taglib-uri>

  http://mycompany.com/taglibs/mytag

  </taglib-uri>

  <taglib-location>

  /WEB-INF/lib/myjar.jar

  </taglib-location>

  </taglib>


The file mytag.tld contains the following:
  <?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">

  <taglib>

  <tlibversion>1.0</tlibversion>

  <jspversion>2.0</jspversion>

  <shortname>mytag</shortname>

  <tag>

  <name>myTag1</name>

  <tagclass>com.mycompany.MyTag</tagclass>

  </tag>


  </taglib>




Re: Jarring custom taglibs: looking for a file named taglib.tld

Posted by Keith Hankin <ke...@addr.com>.
I want the tld file to be packaged in the jar file along with the custom
class so that it is a reusable component, so I don't want to put it in
WEB-INF.

----- Original Message -----
From: "Adam Smith" <aj...@csolve.net>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, June 11, 2004 5:57 PM
Subject: Re: Jarring custom taglibs: looking for a file named taglib.tld


> You could just put the tld in WEB-INF and reference it from the web.xml.
>
> This is the entry in my web.xml for the taglib I use all the time:
>
> <taglib>
>         <taglib-uri>
>     http://localhost/myapp/asl
>         </taglib-uri>
>         <taglib-location>
>            /WEB-INF/asl.tld
>         </taglib-location>
> </taglib>
>
> asl.tld is physically present in WEB-INF.
>
> Don't know if this helps, since it is not exactly what you are trying to
do.
>
> Adam
> ----- Original Message -----
> From: "Keith Hankin" <ke...@addr.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Friday, June 11, 2004 5:02 AM
> Subject: Jarring custom taglibs: looking for a file named taglib.tld
>
>
> <snip>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Jarring custom taglibs: looking for a file named taglib.tld

Posted by Adam Smith <aj...@csolve.net>.
You could just put the tld in WEB-INF and reference it from the web.xml.

This is the entry in my web.xml for the taglib I use all the time:

<taglib>
        <taglib-uri>
    http://localhost/myapp/asl
        </taglib-uri>
        <taglib-location>
           /WEB-INF/asl.tld
        </taglib-location>
</taglib>

asl.tld is physically present in WEB-INF.

Don't know if this helps, since it is not exactly what you are trying to do.

Adam
----- Original Message -----
From: "Keith Hankin" <ke...@addr.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, June 11, 2004 5:02 AM
Subject: Jarring custom taglibs: looking for a file named taglib.tld


<snip>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org