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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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>
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

radarshCommented:
Richards,

My last post should have clarified your doubt!

________
radarsh
radarshCommented:
You should be using

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


________
radarsh
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
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
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" %>

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
radarshCommented:
Also read the last two sentences of my first post carefully.

________
radarsh
RichardsAuthor Commented:
Thanks but now what I need to do as the error is still coming
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
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
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.
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.