This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes TagHandler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "TagHandler" Watch "TagHandler" New topic


Akhil Maharaj
Ranch Hand

Joined: Sep 29, 2007
Posts: 63
Hi ,
I am using Tomcat 6.0.14 . I noticed that unless I put my TagHandler class in a package , my JSP is not working . What ever examples I found in HFSJ and other material on the net , always taghandlers are in a package .

Is there any rule that Taghandlers need to be packaged ?

In both cases , TagHandler class is being proeprly placed by eclipse.
In case of packaged version it is
web-inf/classes/com/tags/CustomTags1.class and in case of default package it is at web-inf/classes/CustomTags1.class

Here is the working version , I am attaching TagHandler, TLD and JSP

Here is the NON-WORKING version of the same in a default package .
I am attaching Taghandler , TLD , JSP again

Please let me know - What I am missing .

[ December 14, 2007: Message edited by: Akhil Maharaj ]
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Is there any rule that Taghandlers need to be packaged ?

Yes. From JSP2.0, everything must be in packages. Leaving your classes in the default package might work on some containers, but you really should avoid it.

JSP.11.2 JSP Page Implementation Class
As of JSP 2.0, it is illegal to refer to any classes from the unnamed (a.k.a.default) package. This may result in a translation error on some containers, specifically those that run in a JDK 1.4 or greater environment. It is unfortunate,but unavoidable, that this will break compatibility with some older JSP applications. However, as of JDK 1.4, importing classes from the unnamed package is not valid (see for details). Therefore, for forwards compatibility, applications must not rely on the unnamed package.

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: TagHandler
It's not a secret anymore!