• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding TLD

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic