[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Unable to locate tag library

Posted on 2006-03-22
18
Medium Priority
?
4,311 Views
Last Modified: 2013-11-19
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
0
Comment
Question by:Richards
  • 9
  • 6
15 Comments
 
LVL 10

Expert Comment

by:radarsh
ID: 16260940
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
 
LVL 10

Accepted Solution

by:
radarsh earned 200 total points
ID: 16261015
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
 

Author Comment

by:Richards
ID: 16261057
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:radarsh
ID: 16261108
Richards,

My last post should have clarified your doubt!

________
radarsh
0
 
LVL 10

Expert Comment

by:radarsh
ID: 16261113
You should be using

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


________
radarsh
0
 

Author Comment

by:Richards
ID: 16261212
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
 
LVL 10

Expert Comment

by:radarsh
ID: 16261255
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
 

Author Comment

by:Richards
ID: 16261459
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
 
LVL 10

Expert Comment

by:radarsh
ID: 16261518
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
 
LVL 10

Expert Comment

by:radarsh
ID: 16261529
Also read the last two sentences of my first post carefully.

________
radarsh
0
 

Author Comment

by:Richards
ID: 16261616
Thanks but now what I need to do as the error is still coming
0
 
LVL 10

Expert Comment

by:radarsh
ID: 16261665
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
 

Author Comment

by:Richards
ID: 16261684
No they are not new tlds The same tlds are working in WSAD and when moved to RAD it is giving that error
0
 
LVL 10

Expert Comment

by:radarsh
ID: 16261711
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
 

Author Comment

by:Richards
ID: 16261953
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month18 days, 1 hour left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question