File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes custom tags & tag handlers REVISITED Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "custom tags & tag handlers REVISITED" Watch "custom tags & tag handlers REVISITED" New topic
Author

custom tags & tag handlers REVISITED

Erick Martin
Greenhorn

Joined: May 17, 2002
Posts: 8
Hi there, this topic is not new but so far I don't seem to get it working.
This is my .tld file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>templateTLD</short-name>
<uri>/tlds</uri>
<display-name>templateTLD</display-name>
<description>Template Tags</description>
<tag>
<name>insert</name>
<tagclass>com.mydomain.view.template.tags.InsertTag</tagclass>
<body-content>JSP</body-content>
<small-icon></small-icon>
<large-icon></large-icon>
<description>An insertion tag</description>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>String</type>
</attribute>
<attribute>
<name>template</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>String</type>
</attribute>
</tag>
</taglib>
AND here is JSP where I'm using this library
<%@ taglib uri="/templateTLD" prefix="template" %>
<template:insert template="/templates/sidedTemplate.jsp">

</template:insert>
There is an entry into web.xml reading :
<taglib>
<taglib-uri>/templateTLD</taglib-uri>
<taglib-location>/WEB-INF/tlds/barSidedTemplate.tld</taglib-location>
</taglib>
When invoking the JSP file, I get the following error:
Unable to load class com.mydomain.view.template.tags.InsertTag
barSidedTemplate.tld is sitting @ WEB-INF/tlds
InsertTag is under WEB-INF/classes/com/mydomain/servlets/view/template/tags
This is the package name: package com.mydomain.view.template.tags;
I am using JRun.
Any suggestions? Thanks in advance.
[ May 30, 2002: Message edited by: Erick Martinez ]

sa<br />Sun Certified Programmer for Java 2 Platform<p>"... black holes are those places in the Universe where God attempted to divide by zero"
Erick Martin
Greenhorn

Joined: May 17, 2002
Posts: 8
Hi Erick, try just placing your InsertTag into
WEB-INF/classes/com/mydomain/view/template/tags
it should work then.
mustang india
Ranch Hand

Joined: Feb 05, 2002
Posts: 60
I think ur TagHandler class should be in
"WEB-INF/tld/com/mydomain/servlets/view/template/tags
"
instead of
"WEB-INF/classes/com/mydomain/servlets/view/template/tags
"
Try this out.
mustang india
Ranch Hand

Joined: Feb 05, 2002
Posts: 60
oops , I am sorry it should be
"WEB-INF/tld/com/mydomain/view/template/tags
"
mustang india
Ranch Hand

Joined: Feb 05, 2002
Posts: 60
Guys,
I am really sorry. Eric is right.
Got confused with class file and tld file. Once again I apologise.
Mustang.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: custom tags & tag handlers REVISITED
 
Similar Threads
facelets and custom tags
String[] as attribute to custom tag
displat:table tag pls help me
jsp tag libraries problem
jakarta-tomcat-4.0.1 taglib problem