File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

custum tag

 
Dominic Paquette
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Sam Dalton
Author
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation
Dominic
 
Dharmin Desai
Ranch Hand
Posts: 81
  • 0
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
yi zhu
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic