Smita Kotnis wrote:

> Hi All,
>         I need to use a taglib developed by third party in my JSPs.

 > I have one .jar and a .tld file with me. Where to put these files so
 > that my tomcat 3.2 understands it? I tried following options,

> 1. Made a directory as tld under WEB-INF and tried to call it in my

 > JSP as,

>
> <@@ tag lib uri=/WEB-INF/mytaglib.tld prefix=\"test\" %>
> (As described in a book by Hans )
>
> 2. Put that tld in some directory and gave class path pointing to

 > that file.

>
> Both of these ways failed. I am still getting the error that tag lib

 > not found !!

> What is the exact way to use tag libs? Where to put these files? Thanks

> in advance.


The JAR file always go in the WEB-INF/lib directory for the application.

You can identify the TLD file in two ways in the taglib directive:
1) By using a file path as the "uri" attribute value. For example,
    if the TLD file is stored in /WEB-INF/tlds/mylibrary.tld, use
    <%@ taglib uri="/WEB-INF/tlds/mylibrary.tld" prefix="xxx" %>
    It sounds like you didn't use the correct path when you tried this
    alternative.

2) By using a symbolic name as the "uri" attribute value, and map the
    symbolic name to a file path in the web.xml file for the application.
    For instance, with the TLD in the same location as before, you
    can use <%@ uri="/mylibrary" prefix="xxx" %> if you also put this
    in the web.xml file:

      <web-app>
        ...
        <taglib>
          <taglib-uri>/mylibrary</taglib-uri>
          <taglib-location>/WEB-INF/tlds/mylibrary.tld</taglib-location>
        </taglib>
        ...
      </web-inf>

In both cases, the file path can be to the JAR file instead of to a
separate TLD file, if the TLD is included in the JAR file as
"META-INF/taglib.tld".

All of this is described in my JSP book in Chapter 8, the Using
Custom Actions section, and in more detail in Chapter 16, the
Packaging and Installing a Tag Library section.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to