You should not be using the package java at all.
Your code should look like
package com.yourcompany;
public class TestTagClass extends ..
And you need to specify the package of your code in the taglib
Main Topics
Browse All TopicsI am trying to run a sample custom tag java application. I get this error:
org.apache.jasper.JasperEx
I have double and triple checked all of the paths and directory structure but the error remains the same.
Here is what I have:
The directory structure starts with the root at: c:\Java Projects\WebStuff\WebAppli
I think these are the important files:
build\web\index.jsp
build\web\WEB-INF\classes\
build\web\WEB-INF\lib\jstl
build\web\WEB-INF\lib\stan
build\web\WEB-INF\tlds\TLD
build\web\WEB-INF\web.xml
here are some code snippets:
index.jsp:
<%@ taglib uri="TheTag" prefix="tt"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>JSP Page</h1>
<tt:TestTag/>
</body>
</html>
__________________________
web.xml:
<web-app xmlns="http://java.sun.com
xmlns:xsi="http://www.w3.o
xsi:schemaLocation="http:/
version="2.4">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>TheTag</taglib
<taglib-location>/WEB-INF/
</taglib>
</web-app>
__________________________
TLDTest.tld:
<taglib version="2.0" xmlns="http://java.sun.com
<tlib-version>1.0</tlib-ve
<short-name>tt</short-name
<uri>/WEB-INF/tlds/TDLTest
<tag>
<name>TestTag</name>
<tagclass>java.TestTagClas
</tag>
</taglib>
__________________________
I suspect that for some reason the java.TestTagClass in not being found because I can change the <tagclass> value to anything and I get the same error.
I really want to get this thing to work so I can move on-- your help is appreciated!
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thank you both for your replies.
pkwan-- You are right. I copied and pasted incorrectly, the code does not work with java.TagTest either. Sorry about that.
dbkruger-- What difference does it make if I use com or java for the package? I created a package called "java" and put the class in there. How do specify the name of the package in the taglib?
Thanks.
owenli is right. That name was changed. See table 10.1 at
http://www.phptr.com/artic
Thank you for your comments. The link above has some useful information in it. I made the changes the tags to use the current tag names but I still get the same error:
Unable to load tag handler class "java.TestTag" for tag "tt:TestTag"
It's as though it can't find java.TestTag. If I change the value of <tag-class> in the TLDTest.tld file to "java.some_random_value" I get the same error:
Unable to load tag handler class "java.some_random_value" for tag "tt:TestTag"
Don't know what's going on.
>>Unable to load tag handler class "java.TestTag" for tag "tt:TestTag"
- in your initial posting, your file path ans name should be "build\web\WEB-INF\classes
- use directly point to your TLD file in index.jsp taglib directive instead of indirect uri pointing to reduce possible errors. Change this line: <%@ taglib uri="TheTag" prefix="tt"%>
to: <%@ taglib uri="/WEB-INF/tlds/TDLTest
Good Luck
>now go relax.
Not while there is so much more to learn !
>I don't understand why it would care what name is used in a package, but it does.
Please read
http://tomcat.apache.org/t
It would seem that Tomcat will always see the official java package before it sees the one you have created.
It's not a good idea to change something in the java package under any circumstances, but in this case there are security issues.
Imagine you're a web server, being told to access code in the standard package, but to replace it by user code. In your case of course, you were writing a new class, but they don't know that. Imagine you re-wrote System.OutputStream. Should everyone else have to run your version? There are many much more subtle issues, but the bottom line is that you don't own the java package, the language does. Unless you are re-implementing a feature from Sun, you should stay in your own namespace.
Glad to be of help!
cheers,
Dov
Business Accounts
Answer for Membership
by: pkwanPosted on 2007-01-02 at 07:10:36ID: 18228024
I guess you are typing java.TestTagClass wrongly. Since your class should be: java.TagTest