• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Urgent: My JSP taglib problems and errors running on Tomcat 4.0

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings! This is my first jsp taglib testing. I got these problems when running it. Isn't that I need to download some plugin or add-on in order to run it? Please give me your hand on this. Thank you! My code as below:
My java file under c:\program files\Apache Tomcat 4.0\webapps\examples\jsp\Hello.jsp:
----------------------------------------------
<%@ taglib uri="mytab" prefix="first" %>
<HTML>
<HEAD>
<TITLE>Hello Tag</TITLE>
</HEAD>
<BODY bgcolor="#ffffcc">
<B>My first tag prints</B>:
<first:hello/>
</BODY>
</HTML>
------------------------------------------------

My tld file under My java file under c:\program files\Apache Tomcat 4.0\webapps\examples\Wed-inf\jsp\Mytaglib.tld:
----------------------------------------------------------
<?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>tags.HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Say Hi</info>
</tag>
</taglib>
----------------------------------------------------------
My java tag is under c:\program files\Apache Tomcat 4.0\webapps\examples\Wed-inf\classes\tags\HelloTag.java:
----------------------------------------------------------------
package tags;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class HelloTag extends TagSupport {
public int doStartTag() throws JspException {
try {
pageContext.getOut().print("This is Anson first tag!");
} catch (IOException ioe) {
throw new JspException("Error: IOException while writing to client" + ioe.getMessage());
}
return SKIP_BODY;
}
public int doEndTag() throws JspException {
return SKIP_PAGE;
}
}
-------------------------------------------------------------------
My web.xml under c:\program files\Apache Tomcat 4.0\webapps\examples\Wed-inf\wed.xml:
-------------------------------------------------------------------
..
..
<taglib>
<taglib-uri>mytab</taglib-uri>
<taglib-location>/WEB-INF/jsp/mytaglib.tld</taglib-location>
</taglib>
</web-app>
--------------------------------------------------------------------
When I restart the Tomcat server 4.0 I got the error of :
PARSE error at line 283 column 11
org.xml.sax.SAXParseException: The content of element type "wed-app" must match "(icon?display-name?,description?,distributable?,context-param*,filter*................... ejb-loccal-ref*)".
In IE browser I run http://localhost:8080/examples/jsp/Hello.jsp.
I got these error Apache Tomcat/4.0.3 - HTTP Status 404 - /examples/jsp/Hello.jsp
------------------------------------------------------------------------
type Status report
message /examples/jsp/Hello.jsp
description The requested resource (/examples/jsp/Hello.jsp) is not available.
------------------------------------------------------------------------
 
author
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"anson",
Thanks for participating here at the Ranch. However, the name you are using does not comply with our naming convention described at http://www.javaranch.com/name.jsp . Please log in with a new name, which meets these requirements.
You can change your name here.
Thanks.
Sean
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Inside your web.xml, the <web-app> element is malformed, the parser error indicates this.
You didn't include enough of the web.xml file to figure out what is wrong, but have a look at your <web-app> element there, paying close attention to the DTD.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I noticed that one of your directories was called "Wed-inf". Is that on purpose? Or were you trying for WEB-INF, as in the web.xml files taglibrary location?
reply
    Bookmark Topic Watch Topic
  • New Topic