• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 5006
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
 
BWA HA HA HA HA HA HA! Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic