• 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

custum tag

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I noticed that, when writing a tag handler class, if I don't specify a package delaration, I get a translation error when trying to access the jsp page where the tag is used. Does anybody know if this is specific to Tomcat?
Thanks in advance
Dominic
 
Author
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dominic,
There is a very good reason for this behaviour. When a JSP page is translated into a servlet at run time it is placed in a package (for tomcat this is org.apache.jsp). In order for this servlet to correctly use your tag handler it must import its package, and if the tag handler is not in a package it can't import it.
Hope this helps
Cheers
Sam
 
Dominic Paquette
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the explanation
Dominic
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sam and Dominic,
I understand the question and now i can also realise that, but Sam i m unable to understand yr answer.

When a JSP page is translated into a servlet at run time it is placed in a package (for tomcat this is org.apache.jsp). In order for this servlet to correctly use your tag handler it must import its package, and if the tag handler is not in a package it can't import it.


Sam, Even When i m declaring a Tag handler class in a package that time also my Tag Handler class is not importing org.apache.jsp package.
Sam, Please elaborate yr answer.
Sincerely yours, Dharmin
 
Sam Dalton
Author
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dharmin,
If you look at the servlet that is generated from your JSP page (this can be found in the %TOMCAT_HOME%/work directory) you will see that it imports your tag handlers package.
n.b.: this has changed slightly as of Tomcat 5, as there are lots of other complications introduced (you still need to package your tags however!)
Hope this helps.
Sam
[ January 09, 2003: Message edited by: Sam Dalton ]
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using Tomcat 4.1. The servlet generated from my jsp did not[B] import my tag package. When my tag handler class was used, this servlet used the full qualified class name of my handler class.
However, as mentioned by Sam, this servlet has his own package called [B]org.apache.jsp
. So when your tag handler class has no package declaration, this servlet will look it up in org.apache.jsp and all imported package. This will be obviously fruitless.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic