Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Regarding TLD  RSS feed

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I placed myFunction.tld file under web-inf directory :

<?xml vesrion="1/0" encoding="ISO-8859-1" ?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">

<tlib-version>1.2</tlib-version>

<uri>DiceFunctions</uri>

<function>
<name>rollIt</name>
<function-class>foo.DiceRoller</function-class>
<function-signature> int rolldice()</function-signature>
</function>

</taglib>

even i chnaged this file name to DiceFunctions.tld

still getting org.apache.jasper.JasperException: File "/DiceFunctions" not found
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Following is my jsp code

<%@ taglib prefix="mine" uri="DiceFunctions" %>

<html>
<body>

${mine:rollIt()}

</body>
</html>
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to put a slash "/" in front of the uri (in the TLD and in the JSP as well).
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried putting /DiceFunctions in TLd as well in JSP but getting following error

Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/myFun.tld: (line 1, col 20)
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try mapping the uri name in web.xml using taglib tag. Remove the slash you added now.
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
even getting the same error
Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/myFun.tld: (line 1, col 20)
org.apache.jasper.servlet.JspServletWrapper.handleJspExceptionRemoved the slash and added

<taglib>DiceFunctions</taglib> in web.xml after <jsp-file> tag

<servlet>
<servlet-name>Hobby Page</servlet-name>
<jsp-file>/TestBean2.jsp</jsp-file>
<taglib>DiceFunctions</taglib>
</servlet>


i think its xml parsing error in tld file..
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my tld file is


<?xml vesrion="1.0" encoding="ISO-8859-1" ?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"

version="2.0">

<tlib-version>1.2</tlib-version>

<uri>DiceFunctions</uri>

<function>
<name>rollIt</name>
<function-class>foo.DiceRoller</function-class>
<function-signature> int rolldice()</function-signature>
</function>

</taglib>
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put your web.xml, yout tld file and your jsp back as they were at the beginning. You've got the following error :

still getting org.apache.jasper.JasperException: File "/DiceFunctions" not found


I didn't give it a good look the first time, but I believe you're problem is not with the TLD. Are your forwarding the request from a servlet to "/DiceFunctions" ? If so, you've got a servlet mapping problem.
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now this is my error :

Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/myFun.tld: (line 1, col 20)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first line of your file, you've got a very strange tag.
It should read version="1.0", not vesrion="1/0"
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satou,

I changed this..Can you please check latest code i posted and reslove the problem..

Thanks
Manju
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wondering the mandatory emements for taglib.
which are <tagb-version> and <short-name>.
There are not <short-name> in your code.
I hope it help you
 
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!