Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CUSTOM TAG NOT WORKING

 
Sanjay Deshpande
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My tag has comiLped.
i have tld like this :
---------------------------------------
<?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>HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Say Hi</info>
</tag>
</taglib>
--------------------------------------
HERE IS MY WEB.XML:
-------------------------------------
<taglib>
<taglib-uri>mytags</taglib-uri>
<taglib-location>/WEB-INF/jsp/mytaglib.tld</taglib-location>
</taglib>
--------------------------------------
HERE IS MY JSP:
-------------------------------------
%@ taglib uri="/WEB-INF/jsp/mytaglib.tld"
prefix="first" %>
<HTML>
<HEAD>
<TITLE>Hello Tag</TITLE>
</HEAD>
<BODY bgcolor="#ffffcc">
<B>My first tag prints</B>:
<first:hello/>
</BODY>
</HTML>
-------------------------------------
I GET FOLLOWING ERROR:
PLZ LEMME KNOW THE SOLUTION
org.apache.jasper.compiler.CompileException: C:\TomCat\jakarta-tomcat-3.3a\webapps\examples\jsp\Hellotag.jsp(0,0) Unable to open taglibrary /WEB-INF/jsp/mytaglib.tld : Parse Error in the tag library descriptor: External entity not found: "http://java.sun.com/j2ee/dtds/
web-jsptaglibrary_1_1.dtd".
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is that the taglib description file cannot be validated. You
set the dtd like this
PUBLIC "-//Sun Microsystems, Inc.//
DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/
web-jsptaglibrary_1_1.dtd">
so i think when you test your jsp you have no
internet connection. Try to download the DTD and
to store it in your xml path then it should work
Hope this helps
 
boyet silverio
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
error arises if the following lines were cut as follows:
------
"http://java.sun.com/j2ee/dtds/
web-jsptaglibrary_1_1.dtd">
PUBLIC "-//Sun Microsystems, Inc.//
DTD JSP Tag Library 1.1//EN"
------
Take note that of the item in between double quotes.
You could straighten these just like in the ff lines:
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
Also, it is better to put your tag handler class in a package dir. If it is not,
sometimes it works, sometimes not. Based on error messages appearing when not working,
the servlet engine assumes that the tag handler class (not in a package dir)
is inside the org.apache package.
And, a minor suggestion. For better identification, your TLD file is better placed in
a dir called something like 'tld' not 'jsp'. A dir called 'jsp' is usually for containing jsp files.
with the corrections in place, and your tag handler class in order,
your jsp should work.
hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic