Unable to locate tag library

The test.tld file is in /WEB-INF/tld/ but I am getting the below error

JSPG0047E: Unable to locate tag library for uri /WEB-INF/tld/test.tld
RichardsAsked:
Who is Participating?
 
radarshCommented:
In your case you should be doing

  <taglib>
    <taglib-uri>http://www.com.foo.org/tlds/test</taglib-uri>
    <taglib-location>/WEB-INF/tld/test.tld</taglib-location>
  </taglib>

In your JSP,

give the URI to what you specify in web.xml.

<%@ taglib prefix="test" uri="http://www.com.foo.org/tlds/test" %>

Note that the URI can be anything. I just gave an example.
You can even give /WEB-INF/tld/test.tld as the URI. But the location is important.

________
radarsh
0
 
radarshCommented:
Hi Richards,

You need to have the uri mapped to the location in your web.xml.

  <taglib>
    <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
  </taglib>

The above is for servlet version 2.3 and below.

In 2.4, there is no such tag as taglib in web.xml. All you have to give then, is the URI
which you can find in the .tld file itself.
________
radarsh
0
 
RichardsAuthor Commented:
I am not using struts and here is the web xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="Testap">

<taglib>
      <taglib-uri>testTags</taglib-uri>
      <taglib-location>/WEB-INF/tld/test.tld</taglib-location>
 </taglib>
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
radarshCommented:
Richards,

My last post should have clarified your doubt!

________
radarsh
0
 
radarshCommented:
You should be using

<%@ taglib prefix="test" uri="testTags" %>


________
radarsh
0
 
RichardsAuthor Commented:
In the JSP I am using as below
<%@ taglib uri="test.tld" prefix="cpt" %>

Please let me know how this prefix cpt  or prefix = "test" in your case will be related
0
 
radarshCommented:
Richards,

You can give any prefix... That doesn't matter at all. The only thing is you have to literally
*prefix* the prefix.

I mean, you have to use <prefix:tagname...
In your case <cpt:whatever

Well, your URI is wrong. You *should* give what you define in your
web.xml. I see from you previous post that it is testTags.

So, change that to

<%@ taglib uri="testTags" prefix="cpt" %>

________
radarsh
0
 
RichardsAuthor Commented:
On the other machines
<%@ taglib uri="/WEB-INF/tld/test.tld" prefix="cpt" %> is working and on my application server it is not working . So what is the difference in

<%@ taglib uri="testTags" prefix="cpt" %>

and

<%@ taglib uri="/WEB-INF/tld/test.tld" prefix="cpt" %>

0
 
radarshCommented:
You mean the same code works on other machines?
Bleak Possibility!

Burn this into your brain:

*** All are legal provided you have the uri mapped to the proper tld file in your web.xml ***

URI is like a key. That's all. And to make sure it is unique, they follow that convention
of naming them like websites. But it is not mandatory. You can give anything and it'll work.

________
radarsh
0
 
radarshCommented:
Also read the last two sentences of my first post carefully.

________
radarsh
0
 
RichardsAuthor Commented:
Thanks but now what I need to do as the error is still coming
0
 
radarshCommented:
Then I guess your tld file is not proper.

Refer http://java.sun.com/developer/Books/javaserverpages/cservletsjsp/chapter14.pdf

for a complete discussion in case you are trying out tld creation yourself.

________
radarsh
0
 
RichardsAuthor Commented:
No they are not new tlds The same tlds are working in WSAD and when moved to RAD it is giving that error
0
 
radarshCommented:
Are you sure you created a Web 2.3 project in RAD? If you have created a 2.4 one, you have to
give the uri present in the tld file itself as i said earlier.
0
 
RichardsAuthor Commented:
in the projects properties the level shows

J2EE 1.3 includes Connector Architecture Specification level 1.0, Servlet Specification level 2.3, JSP Specification level 1.2, and EJB Specification level 2.0.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.