This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in JSP URGENT!!!!

 
Rakesh Patel
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Antonio, Rodriguez
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
mahadevan raja
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
r venkat
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic