aspose file tools*
The moose likes Servlets and the fly likes Problem in JSP URGENT!!!! 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 » Java » Servlets
Bookmark "Problem in JSP URGENT!!!!" Watch "Problem in JSP URGENT!!!!" New topic
Author

Problem in JSP URGENT!!!!

Rakesh Patel
Greenhorn

Joined: Jan 18, 2001
Posts: 19
Hi All,
I am using Java Webserver 2.0 & am able to run my jsp's, the problem i am getting is when i try to use bean in my jsp file giving the class like without giving any package name
<jsp:useBean id='letterColor' scope='application' class='AlphabetCode' type="AlphabetCode" />
I am not able to run the jsp inspite of having AlphabetCode in classes folder but if i specify like this
<jsp:useBean id='letterColor' scope='application' class='sunexamples.beans.AlphabetCode' type="sunexamples.beans.AlphabetCode" />
& place the AlphabetCode Class in classes/sunexamples/bean folder with giving package declaration it works fine.
I don't know why it not works..
If anybody can help, it would be gr8...
Thanx in Advance..
Rakesh Patel.
Antonio, Rodriguez
Greenhorn

Joined: Apr 19, 2001
Posts: 2

Hi Rakesh:
You can�t get the bean because the JVM "thinks" that it is in the sunexamples.beans directory (Its package hierarchy).

Try this:
If you want to use bean in your jsp file giving the class without giving any package name you have to delete the package sentence in your source file(AlphabetCode.java), then execute the javac command again and overwrite the old AlphabetCode.class from your classes directory.

Anyway, I recommend you to use the second way, giving the package name.
It�s all I can say.
Luck!
Rakesh Patel
Greenhorn

Joined: Jan 18, 2001
Posts: 19
Thanks Antonio
I have tried without giving the package name in source file and then put the class file in /classes folder of JWS but it doesn't work.
While giving the package name sunexamples.beans in source file and placing the class file in classes/sunexamples/beans folder it works fine.
I just want know how could I use the class lying in /classes folder.
Thank you in advance.
Rakesh
mahadevan raja
Ranch Hand

Joined: Apr 11, 2001
Posts: 96
hello rakesh,
normally there is a simple logic that beans have to be stored in specified directories,i am working in websphere,here beans have to be stored in the webspheresamples directory,else it wont work,i have not worked in jws,but as u have mentioned,when u give sunexamples.beans.classname it works ,it follows the same logic,
try doing one thing,create a new folder of ur own in sunexamples,store the class in this folder,and then use this package,if it doesnt work,place a new folder in sunexamples/beans/ and try out,this wud work.
basic logic is beans have to be stored in specified directories,it is a must,i have tried without using packages in websphere,it doesnt work.
hope i am right,try it out
-rm.


SPECIALIST-WCSV5.1 Implementation.<br />SYSTEMS EXPERT-WAS4.0 Administration
r venkat
Greenhorn

Joined: Jan 09, 2001
Posts: 8
hi rakesh,
you cant use a bean in a JSP if it is not in a package. So as
madhaven raja tells you should follow a directory hierarchy.
try giving a package name and placing the bean in that package then 'packagename.beanname' should work.
all the best
ven
Rakesh Patel
Greenhorn

Joined: Jan 18, 2001
Posts: 19
Thank you all.
I tried as per your suggestion by giving the package name and it works fine now.
Thanks once again to JavaRanch and members.
Rakesh
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem in JSP URGENT!!!!
 
Similar Threads
Is javabean should be in package?
Bean Importing error
The value for the useBean class attribute "..." is invalid.
Tomcat 4.0.1 - cannot create bean of class
InstantiationException: bean not found within scope