File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Is package name necessary for jspUsebean tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Is package name necessary for jspUsebean tag?" Watch "Is package name necessary for jspUsebean tag?" New topic
Author

Is package name necessary for jspUsebean tag?

Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
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

Joined: Feb 07, 2005
Posts: 643
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

Joined: Apr 19, 2006
Posts: 310
Package is not necessary for JavaBeans.


SCJP 5.0<br />SCWCD 1.4<br />Preparing for <b>SCEA</b>.<br /><b>"I prefer an interesting vice to a virtue that bores."</b>
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Why the compiler throws an exception? I'm using tomcat 5.0, is it mandatory or a bug?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Yes, the beans need to be in a package. Tomcat started to enforce that in version 5.


Ping & DNS - updated with new look and Ping home screen widget
Johan Pelgrim
Ranch Hand

Joined: Jul 07, 2003
Posts: 105

It's good practice anyway! I've seen very odd behavior before when classes aren't in packages!


Johan Pelgrim, The Netherlands
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Thanks for the enlightenment Ranchers, package name is neccessary
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is package name necessary for jspUsebean tag?
 
Similar Threads
Q. on Custom Tag Library
Why the result is 1,0
class within class css query?
Unable to retreive bean object in servlet with request scope
el attribute inside a custom tag body is accessible out side the scope of the custom tag?