aspose file tools*
The moose likes JSP and the fly likes Unable to load tag handler class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to load tag handler class" Watch "Unable to load tag handler class" New topic
Author

Unable to load tag handler class

omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Hello friends,

I am learning Custom Tags. I was trying an example using both the methods:-

1) Simple Tags method
2) Classic Tags method

The program's intention is as follows. In the jsp, i use my custom tag to greet the user depending upon the time of the day. For example when the jsp page is requested before 2.00 pm ...the user will be greeted as "Good morning sir" and the time is shown.

I am able to achieve this using the Simple tag approach, but not using the classic tag approach.

After my Simple tag approach, was working, i went on copy pasting spree changing where ever it was required for Classic Tag approach...but i am getting an exception as follows :-


/view/ClassicCustomGreetTagFile.jsp(16,16) Unable to load tag handler class "org.omkar.swa.components.tagHandlers.GreetClassicNoBodyTagHandler" for tag "swa:classicGreet"...


Here are the details of the classic tag approach :-

==============================================================================================================
The Tag handler class:-

==============================================================================================================

==============================================================================================================
The TLD File

==============================================================================================================

==============================================================================================================
The jsp page:-
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib prefix="swa" uri="customGreetClassicTagWithNoBody"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SWA - An example of custom tag that will greet user as per time of the day...SIMPLE TAGS</title>
</head>
<body>
An example of custom tag that will greet user as per time of the day... but using SIMPLE TAGS

<br>
<br>
<br>
hello and ..... <swa:classicGreet/>
<br>
<br>
this is also valid.... <swa:classicGreet></swa:classicGreet>
</body>
</html>
==============================================================================================================

I haven't made any configuration in web.xml for the tag, since it worked for SIMPLE Tag approach, i guess it should have also worked for CLASSIC Tag approach.
I am using Tomcat5.5, jdk 1.6, JSP 2.0

Please some one tell me what could be the problem?...initially i did not write the "doEndTag()" method in the tag handler class....but even after writing this method i am getting the same exception. Please some one help me. I am referring the Head First Servlet JSP book.

Por Favor Help me!!!


Thanks and Regards
Omkar Patkar (SCJP 1.4)[url]http://javacollectionsnotes.blogspot.com[/url] | [url]http://omkar-myscjpexp.blogspot.com[/url]
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Guys, please help me out !
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

please carefully check the tld file if you did any spelling mistake.
Match carefully your Tag class and what name your have entered in
tag-class element.

I am used to this exception I solve it by checking correct class entry
and spelling.

best regards,
omi
[ August 18, 2008: Message edited by: omi sharma ]

Back to Java , again.
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Thanks omi....i was able to resolve the issue! There was no problem in the TLD or the class file or jsp....nowhere !

Firstly, I copy pasted the code from my CLassic tag handler into Simple tag handler(...since Simple tag handler was working), and to my surprise ....it was working, so i realized, just as you said, there must be some problem with typing (...rather copy pasting ... he he ) ...but i checked it again and again....but everything was perfect!!!...the TLD, jsp, java file....all the three were perfectly correct !

i was getting at my nerves end!

... after sometime the apple fell on my head ....and i got this idea to check the classes directory under WEB-INF....and it happened to be that, Eclipse did not generate the class file for the custom tag handler....i restarted the eclipse first(...which DID not work) and then the machine.....now its working absolutely fine...as if nothing happened!

phew !...finally !....both SIMPLE and CUSTOM tags work

thank you all !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to load tag handler class