Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems when package statement is missing

 
Suprakash Das
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am using Tomcat 4.0. I wrote a simple tag, without a package statement and placed the MyTag.class file in WEB-INF/classes. The Jsp page using the tag doesn't compile...Compile Exception No class found... MyTag.
When I change the tag to include a package statement it works without a hitch.
This has happened before with other servlet containers. I was wondering if anybody knew the reason for this behaviour of servlet containers.
Thanks in advance.
das
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18272
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd have to show us the taglibrary descriptor. That's what makes a tag accessible. Otherwise there's a potential security problem if I could take any class in the classpath and pretend it was a tag library. Though considering the infrastructure required it's a pretty minor one.
 
Suprakash Das
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the tld for the tag. I placed HelloTag.class under WEB-INF/classes in my webapp.
<tag>
<name>hello</name>
<tagclass>HelloTag</tagclass>
<info>
Print hello and name
</info>
<attribute>
<name>first</name>
<required>true</required>
</attribute>
<attribute>
<name>second</name>
</attribute>
</tag>
I want to know what the jsp engine does when it encounters a class without a package structure.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic