473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Custom taglib problems

Hi all,

Custom taglibs are driving me nuts! I'm trying to install a sample
from the book I'm learning from, and it just falls over.

Here's my class, which compiles without any problems:

import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.io.*;

public class HelloWorldTag extends TagSupport {

public int doStartTag()
throws JspException {

try {
JspWriter out = pageContext.getOut();
out.println("<h1>Hello world. Bet this doesn't work...
Stupid Java</h1>");
}
catch (IOException ioexc) {
throw new JspException(ioexc.toString());
}

return SKIP_BODY;
}
public int doEndTag() {
return EVAL_PAGE;
}
}

Here's my tld, which is in WEB-INF under my web app's root directory:

<?xml version="1.0" encoding="UTF-8"?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
web-jsptaglibrary_2_0.xsd"
version="2.0">

<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>hello</shortname>
<urn></urn>

<info>
HelloWorld taglib that won't work
</info>

<tag>
<name>hello</name>
<tagclass>HelloWorldTag</tagclass>
<info>Simplest example: inserts one line of output</info>
</tag>

</taglib>

I also tried using and old DTD version of the tld, which didn't work
at all. At least I get an error message now...

When I try and load a page with a reference to the taglib, eg:

<%@ taglib uri="WEB-INF/hello.tld" prefix="mytag" %>
<html>
<head>
<title>2-6 on not working</title>
</head>
<body bgcolor=white>

<mytag:hello/>

</body>
</html>

It says:

XML parsing error on file /WEB-INF/hello.tld: (line 3, col 8):
Document is invalid: no grammar found.

I'm guessing this is a schema problem, but can anyone help me clear
this up?

Thanks in advance,
Andy
Jul 17 '05 #1
0 2258

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Luc Tremblay | last post by:
Given the typical following code: void Listener::HandleEvent(const Event& event) { // handling code } In a "clean" fashion, how is it possible to add custom data (to be subsequently...
16
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
0
by: Ken Bass | last post by:
Hello all: I know that this is a very common problem. I have read many web pages and messages about it, and tried all different types of solutions. But nothing seems to work. The problem:...
0
by: Damien Viel | last post by:
Hi all, Is there a taglib engine project written in PHP ? I've seen in smarty project some markup which are looking like what I want to do. In fact I want to write a taglib like it's done in...
1
by: navin123 | last post by:
hi im trying to use taglib in jsp. i hv to jar file called standard.jar and jstl.jar in my lib folder iand in my tld folder i hv c.tld,x.tld,fmt.tld,sql.tld.. n when in my jsp wehn i try to...
3
by: Venkat | last post by:
Hi, I am working on an application (developed using c#2.0) which needs to do a big job and when you start the job in a single thread it takes long time to complete. So, we want to break the job...
0
by: abhilash12 | last post by:
pls give me taglib code for creating iterater tag
2
nathj
by: nathj | last post by:
Good afternoon, I'm about to embark upon a new project using JSP and currently struts. My big issue with the struts tag lib is the heavy use of tables for html page layout. Basically any form is...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.