By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,949 Members | 1,554 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,949 IT Pros & Developers. It's quick & easy.

Custom taglib problems

P: n/a
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.*;

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=""


HelloWorld taglib that won't work

<info>Simplest example: inserts one line of output</info>


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" %>
<title>2-6 on not working</title>
<body bgcolor=white>



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,
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.