• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in JSP URGENT!!!!

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic