• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

problem with tag file

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"?>
<taglib>
<tlib-version>1.0</tlib-version>
<uri>MyVersion</uri>

<tag-file>
<name>NameOfTagFile</name>
<path>/WEB-INF/tags</path>
</tag-file>
</taglib>


added the following entry in web.xml file
<taglib>
<taglib-uri>MyVersion</taglib-uri>
<taglib-location>/WEB-INF/Tagtld.tld</taglib-location>
</taglib>

and used the follwing code as a jsp file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib prefix="c" uri="MyVersion"%>
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="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">
<TITLE>Tagjsp.jsp</TITLE>
</HEAD>
<BODY>
<P> About to include the content from the tag file </P>
<c:NameOfTagFile/>
</BODY>
</HTML>

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.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic