• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with tag file

salil verma
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was testing the approach of tag file ..

I made the following tag file (Tagtest.tag)
<h1> this is from tag file </h1>

and following tld file (Tagtest.tld)
<?xml version="1.0" encoding="UTF-8"?>


added the following entry in web.xml file

and used the follwing code as a jsp file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib prefix="c" uri="MyVersion"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<P> About to include the content from the tag file </P>

but when i try to run the jsp file i get the follwing error message
"Unable to locate tag library for uri MyVersion"

I have put the tag file in /WEB-INF/tags and tld file in /WEB-INF directory.I am using websphere server as environment. using jsp 2.4 environment.
Can any one help me resolve this problem.
Nigel Chou
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you may try to use <%@ taglib prefix="c" tagdir="......"%> instead of <%@ taglib prefix="c" uri="MyVersion"%> And remove anything about it in TLD and DD
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got an example of a working JSP Custom tag library created with IBM's Rational Application Developer here:

Tutorial on Creating a Custom Tag with IRAD and WebSphere

Here's also an EAR file containing a single tag library that indeed works, just in case you want a working reference:

Working EAR with a Simple Custom Tag

There are three key things you might want to doublecheck:

1. Entry in the jsp
2. Creating of tld
3. Reference in the web.xml?

public class TimerTag extends TagSupport {

I'm going to compare that to your code.

Frustrating, isn't it?

-Cameron McKenzie
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!