wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "TagHandler" Watch "TagHandler" New topic
Author

TagHandler

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 .

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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 http://java.sun.com/j2se/1.4/compatibility.html#source 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: http://aspose.com/file-tools
 
subject: TagHandler
 
Similar Threads
setting attributes to be accessed by cutom tag code
simple tags
cannot find the declaration of element taglib
CustomTag
Tag Library Decriptor Problem