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

Regarding JSP Tag libraries

 
Merlin Thomas
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a question regarding the Tag classes that we create for Custom Tags.
why is it manadatory to keep the tag class in a package?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As of JDK 1.4, classes in a package cannot import classes in the "default" package. Rule of thumb: always use a package for every class. It helps with organization as well.
 
Merlin Thomas
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, but then why Servlet classes are not placed in any package i.e we can place them, but i we can also write servlets
without the use of packages.
So why then is it manadatory for a Java bean class and Tag classes.
 
Merlin Thomas
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And Thanks for the reply...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same answer. Also, just because a package-less servlet seems to work, any change in environment could suddenly make it stop working. It's sort of the luck of the draw.

Bottom line: all classes go in a package. All. Every time.

Anything else is irresponsible and a ticking time bomb.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic