Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using java-beans in your jsp  RSS feed

 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I created an application and also a web interface to access mysql tables! My problem currently is using one of the classes of my application in my jsp code! I created a WEB-INF/classes folder as requires and dropped the folders which is also the way the package should be accessed and it gives errors when i am trying to run the page! Your help would be highly appreciated!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please Tell The Details?
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am so sorry i didnt provide so much details to my problem so here they go:
My Jsp code is like this: I just posted the jsp code i have written so far:

When i try to run the page, i get this translation-time error:



I use jdk1.5, i dont know if this could pose a problem!I created a WEB-INF folder and placed the Library/db folder under the classes directory created under the WEB-INF folder! I hope this could help in solving my little problem! Thanks!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saheed,

Can you post the full path to your Database.class file (preferably by pasting from your command line or explorer address window)?
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
Saheed,

Can you post the full path to your Database.class file (preferably by pasting from your command line or explorer address window)?


I also have a jar located in e:\Testing

e:\Testing\Library\db\Database.class

I hope this helps! Thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought you said you have one under WEB-INF.

Can you post the full path to the one that Tomcat is supposed to use?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Note that in addition to giving the package as part of the class name in the useBean tag, you also have to import the class OR give the complete package in every reference.
Bill
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:

Note that in addition to giving the package as part of the class name in the useBean tag, you also have to import the class OR give the complete package in every reference.
Bill


I've never had to do either.

Jasper has always fully qualified any reference to classes defined in a useBean tag in the generated servlet code.

Maybe I'm mis-reading your comment.
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
Thanks for your reply so far! Well as for the full path, i am usually @ a cafe! Here is what i think is the path
f:\windows\ProgramFile\ApacheGroup\ROOT\Web_App\WEB-INF\classes\Library\...
and also f:\windows\programFile\ApacheGroup\ROOT\WEB-INF\lib\Library.jar
This is the path i have! I hope this helps in solving my problem. Thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Saheed Adepoju:
Hi all
Thanks for your reply so far! Well as for the full path, i am usually @ a cafe! Here is what i think is the path
f:\windows\ProgramFile\ApacheGroup\ROOT\Web_App\WEB-INF\classes\Library\...
and also f:\windows\programFile\ApacheGroup\ROOT\WEB-INF\lib\Library.jar
This is the path i have! I hope this helps in solving my problem. Thanks


Have you configured Tomcat to look for webapps in a directory other than TOMCAT_HOME/webapps?
Or have you created your own context.xml file to tell Tomcat where to look for your webapp?

Take a look at this page to see what the structure of a webapp running under tomcat should be
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never had to do either.

Jasper has always fully qualified any reference to classes defined in a useBean tag in the generated servlet code.

Maybe I'm mis-reading your comment.

That comment was based on my experience with previous versions of Tomcat which did not add the package to bean class references, causing exactly that error. I'm glad to hear that the current one catches the problem.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!