• 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

Problem using Custom tag in JSP

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam facing problem when i am deploying my files on j2ee 1.4 server it give following erroer::
my .tld file and jsp are given below
any body can help me;

mytaglib.tld file:
<<?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">
<!-- a tag library descriptor -->
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>first</shortname>
<uri></uri>
<info>A simple tab library for the
examples</info>
<tag>
<name>hello</name>
<tagclass>tags.HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Say Hi</info>
</tag>
</taglib>

MY JSP file :::
<%@ taglib uri="/WEB-INF/mytaglib.tld"
prefix="first" %>
<HTML>
<HEAD>
<TITLE>Hello Tag</TITLE>
</HEAD>
<BODY bgcolor="#ffffcc">
<B>My first tag prints</B>:
<first:hello/>
</BODY>
</HTML>
Error :::
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/mytaglib.tld: (line 1, col 2)
org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:218)
org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:188)
org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:515)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:460)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:526)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1617)
org.apache.jasper.compiler.Parser.parse(Parser.java:174)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:244)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:146)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:132)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:245)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:462)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:448)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:551)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:300)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:284)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:200)
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

XML parsing error on file /WEB-INF/mytaglib.tld: (line 1, col 2)


How much clearer can an error message be? It's saying it's unhappy at line 1 column 2. And if you look there you will see that you have an extra < character. Did you even bother to read the error message?
 
Ajoy Sharma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for reply
I got it
could tell me why this error is comming in same code:
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/mytaglib.tld
 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic