Richards
asked on
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
JSPG0047E: Unable to locate tag library for uri /WEB-INF/tld/test.tld
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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</tagl ib-uri>
<taglib-location>/WEB-INF/ tld/test.t ld</taglib -location>
</taglib>
<?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</tagl
<taglib-location>/WEB-INF/
</taglib>
Richards,
My last post should have clarified your doubt!
________
radarsh
My last post should have clarified your doubt!
________
radarsh
You should be using
<%@ taglib prefix="test" uri="testTags" %>
________
radarsh
<%@ taglib prefix="test" uri="testTags" %>
________
radarsh
ASKER
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
<%@ taglib uri="test.tld" prefix="cpt" %>
Please let me know how this prefix cpt or prefix = "test" in your case will be related
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
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
ASKER
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" %>
<%@ taglib uri="/WEB-INF/tld/test.tld
<%@ taglib uri="testTags" prefix="cpt" %>
and
<%@ taglib uri="/WEB-INF/tld/test.tld
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
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
Also read the last two sentences of my first post carefully.
________
radarsh
________
radarsh
ASKER
Thanks but now what I need to do as the error is still coming
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
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
ASKER
No they are not new tlds The same tlds are working in WSAD and when moved to RAD it is giving that error
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.
give the uri present in the tld file itself as i said earlier.
ASKER
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.
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.
You need to have the uri mapped to the location in your web.xml.
<taglib>
<taglib-uri>/WEB-INF/strut
<taglib-location>/WEB-INF/
</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