File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Tag library.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tag library.." Watch "Tag library.." New topic

Tag library..

Vimala Shirur

Joined: Jan 12, 2001
Posts: 12
My tomcat server can't load my .class file. I get a JasperException saying unable to load com.j2ee.ExampleTag. I have placed this file where other classes are stored (C:\TOMCAT\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\) Can anybody help me to figure this out.
Here are my files
mytag-taglib.tld file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
<!-- a tag library descriptor -->
<!-- after this the default space is
A simple tab library for the examples
<info> Display JSP sources </info>
ExampleTag class
package com.j2ee;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class ExampleTag extends TagSupport
public int doStartTag()
JspWriter out = pageContext.getOut();
out.println("My first Tag Example");
catch(IOException e)
System.out.println("error in ExampleTag: "+ e);

My jsp file
<%@ taglib uri="mytag-taglib.tld" prefix="mytag" %>
<TITLE><mytag:example /></TITLE>
<H1><mytag:example /></H1>
<mytag:example />


William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027
Did you modify the web.xml file to show that this taglib is used in the context? Here is an example:
The other thing to double-check is that the directory structure from WEB-INF/classes exactly matches your package structure.

author of:
I agree. Here's the link:
subject: Tag library..
It's not a secret anymore!