• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TagHandler

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
reply
    Bookmark Topic Watch Topic
  • New Topic