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

problem in creating tag library

Krishna Acharya
Ranch Hand

Joined: Jun 05, 2007
Posts: 34
I am creating Hello World program of custom Tag. for this, I have developed following files:
1. Tag Handler:

package coreservlets.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

public class HelloTag extends TagSupport {

public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
out.print("Custom tag example " +
} catch(IOException ioe) {
System.out.println("Error in ExampleTag: " + ioe);

2. Tag Library Descriptor:
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="" xmlns:xsi="" xsi:schemaLocation=" web-jsptaglibrary_2_0.xsd">
<!-- A validator verifies that the tags are used correctly at JSP
translation time. Validator entries look like this:
<!-- A tag library can register Servlet Context event listeners in
case it needs to react to such events. Listener entries look
like this:

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


3. JSP file:
<%@ taglib tagdir="/WEB-INF/tags/mytld.tld" prefix="mytld" %>

<TITLE>Tag Example</TITLE>

<strong>JSTL Hello World Program </strong>

<H1><mytld:myTag />

Folder structure in tomcat:
| |
| |--tags
| |
| |--HelloTag.class
Problem: requested resource is not available... what is the problem?

Please help me: I am in trouble from long time.

Thanks in advance.
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
The exact error message would be more helpful.

It looks like you do not have the tld under WEB-INF...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63854

Please be sure to use UBB code tags when posting code to the forums. Please read this for more information.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: problem in creating tag library
It's not a secret anymore!