• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is package name necessary for jspUsebean tag?

 
Shyam kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greeting's Ranchers,

I created in bean class RegistrationActionForm within WEB-INF/Classes and tried using jsp:useBean Tag, I got the jsp compilation error that the code contains unresolved reference RegistrationActionForm, I think container could not locate the class.

But when I packaged the class within com.foo, the _jsp code was compiled successfully.

Can anyone tell me why?

Thanks,

Naveen
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in jsp if you use no package(default package)the compiler will throw exception.so it is must to put class in package.
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Package is not necessary for JavaBeans.
 
Shyam kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why the compiler throws an exception? I'm using tomcat 5.0, is it mandatory or a bug?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the beans need to be in a package. Tomcat started to enforce that in version 5.
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's good practice anyway! I've seen very odd behavior before when classes aren't in packages!
 
Shyam kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the enlightenment Ranchers, package name is neccessary
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic