• 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

Tag library..

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<!-- a tag library descriptor -->
<taglib>
<!-- after this the default space is
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd"
-->
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>mytag</shortname>
<uri></uri>
<info>
A simple tab library for the examples
</info>
<tag>
<name>example</name>
<tagclass>com.j2ee.ExampleTag</tagclass>
<info> Display JSP sources </info>
</tag>
</taglib>
ExampleTag class
----------------
package com.j2ee;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
public class ExampleTag extends TagSupport
{
public int doStartTag()
{
try
{
JspWriter out = pageContext.getOut();
out.println("My first Tag Example");
}
catch(IOException e)
{
System.out.println("error in ExampleTag: "+ e);
}
return(SKIP_BODY);
}

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

Thanks,


 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you modify the web.xml file to show that this taglib is used in the context? Here is an example:
<taglib>
<taglib-uri>JSPbook/taglib</taglib-uri>
<taglib-location>
/WEB-INF/jsp/JSPbook-taglib.tld
</taglib-location>
</taglib>
The other thing to double-check is that the directory structure from WEB-INF/classes exactly matches your package structure.

------------------
author of:
 
What are you doing in my house? Get 'em tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic