File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Problem while running JSP Custom Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem while running JSP Custom Tag" Watch "Problem while running JSP Custom Tag" New topic
Author

Problem while running JSP Custom Tag

Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
Hello to all

I am new to JSP Custom Tags.
I am using Tomcat 5.0 and trying to run JSP Custom Tags.Firstly please tell me that is anything else is also required to use JSP Custom Tags.

Now i have made 3 files -:

1) ExampleTag.class in /webapps/root/WEB-INF/classes/coreservlets/tags/

2) csajsp-taglib.tld in /webapps/root/WEB-INF/

3) ram.jsp in /webapps/root/

and in web.xml , which is in /webapps/root/WEB-INF/web.xml i have make changes and write there -:

<taglib>
<taglib-uri>csajsp-taglib.tld</taglib-uri>
<taglib-location>csajsp-taglib.tld</taglib-location>
</taglib>


and in csajsp-taglib.tld i have written -:

<taglib>
<!-- after this the default space is
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd"
-->
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>csajsp</shortname>
<urn></urn>
<info>
A tag library from Core Servlets and JavaServer Pages,
http://www.coreservlets.com/.
</info>

<tag>
<name>example</name>
<tagclass>coreservlets.tags.ExampleTag</tagclass>
<info>Simplest example: inserts one line of output</info>
<bodycontent>EMPTY</bodycontent>
</tag>

</taglib>


Please check my paths and version which i have written in csajsp-taglib.tld, wheather they are correct or not, if wrong then please rectify them.

now when i am running the ram.jsp error is coming -:


org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/csajsp-taglib.tld: (line 3, col 6)
org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:249)
org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:220)
org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:475)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:417)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Please tell me that where i have made an error.

Please help me out.

Regards
Gaurav
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
<urn> should be <uri>


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
sir thanks for your reply , now i have make my <urn></urn> to <uri></uri>
after that also it is giving the same error.

Please tell me that what to do.

Regards
Gaurav
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Do you have this in your tld?

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
thanks for response

Sir i have written this is my TLD file.
The error is coming -:

org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/csajsp-taglib.tld: (line 3, col 13)

i am not able to understand that what problem it might be.

For custom tags should we have to download TAG LIBRARIES from JAKARTA, as i have not downloaded them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem while running JSP Custom Tag
 
Similar Threads
Error using custom tag
Problem using Custom tag in JSP
org. apache. jasper.JasperException:
JasperException: Unable to initialize TldLocationsCache:
Error Displaying Custom Tags in JSp