• Post Reply Bookmark Topic Watch Topic
  • New Topic

Taglib uri..problem..(need help)  RSS feed

 
Radhika Reddy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have created a simple ExampleTag and I am not able to run it from ExampleTag.jsp.I am getting Internal Server Error as jsp-taglib.tld not found.
Below is my directory structure..
devel (Web application directory)
jsp
ExampleTag.jsp
Tags
ExampleTag.java
WEB-INF
tlds
jsp-taglib.tld
classes
moreservlets
tags
ExampleTag.class

my jsp-taglib.tld file is
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<shortname>devel-tags</shortname>
<info>A tag library form more servlets and java server pages</info>
<tag>
<name>example</name>
<tagclass>moreservlets.tags.ExampleTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Simplest example:inserts one line of output</info>
</tag>
</taglib>
Jsp taglib uri is
<%@ taglib uri="/tlds/jsp-taglib.tld" prefix="devel" %>
I am using jdk1.4 and tomcat4.0.4
Please correct me where I am wrong..
I think there is problem in taglib uri..If so what should be the uri for my directory structure?
Thanks,
Radhika
SCJP
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to tell due to the lack of formatting in your post, but if the tld folder is under your WEB-INF folder, you need to include that in the path.
hth,
bear
 
Radhika Reddy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Hope this format helps you to better understand ..
devel (Web application directory)
/jsp
//ExampleTag.jsp
/Tags
//ExampleTag.java
/WEB-INF
//tlds
///jsp-taglib.tld
//classes
///moreservlets
////tags
/////ExampleTag.class
Jsp taglib uri is
<%@ taglib uri="/tlds/jsp-taglib.tld" prefix="devel" %>
I have included tlds in the uri path but I am getting error "/tlds/jsp-taglib.tld" not found
Radhika
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Bear suggested, try the following...
<%@ taglib uri="/WEB-INF/tlds/jsp-taglib.tld" prefix="devel" %>
HTH
Simon
 
Radhika Reddy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Simon,
Now error was gone but its not displaying anything.In view /source I can see custom tag execution but its not displayed on the browser..
here is code for jsp file..
<html>
<head>
<title>Example<title>
</head>
<body>
<%@ taglib uri="/WEB-INF/jsp/msajsp-taglib1.tld" prefix="devel" %>
<h1>Example Tag using custom tags</h1>
<h1><devel:example/></h1>
<devel:example/>
</body>
</html>
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you see the taglibs in the source of your html, then it was not parsed by your container.
try
<%@ taglib uri="/WEB-INF/tlds/jsp-taglib.tld" prefix="devel" %>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!