aspose file tools*
The moose likes JSP and the fly likes CUSTOM TAG NOT WORKING Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "CUSTOM TAG NOT WORKING" Watch "CUSTOM TAG NOT WORKING" New topic
Author

CUSTOM TAG NOT WORKING

Sanjay Deshpande
Ranch Hand

Joined: May 22, 2001
Posts: 111
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

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Aug 28, 2002
Posts: 173
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CUSTOM TAG NOT WORKING