Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a Java Bean from JSP Problem

 
Mike Broad
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my first attempt at trying to call a java bean
from a jsp.
<jsp:useBean id="Books" class="BookStore" scope="page" />
Both .jsp and .class are in the same directory.
Every time I attempt to invoke my jsp, the error message
BookStore.class not found appears.

Can anybody shine some light on this problem?
(Currently using Tomcat).
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't pretend to solve you problem, but in your case, the JSP and .class file may have to be in different specific DIRs dictated by your configuration.
And if your *.class files and *.jsp files are in the same DIR, that tells me that that may be the problem.
Usually a Web application requires that the JSPs and the .class files be in *different* DIRs.
At least with out of the box configurations.
Your mileage may vary!
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that your bean does not belong to any package.
And can you let us know what was the way you invoked your bean?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Tomcat, .jsp files go with the normal HTML files, while class files go is a separate directory.
Assuming you have not created a specific application and are using ROOT for your HTML and JSP files, classes go in
/tomcat/webapps/ROOT/WEB-INF/classes
Tomcat uses the Sun J2EE scheme of organizing web applications see the Java servlet 2.2 API for details. It is laid out in great detail there.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If u r using IIS and ServletExec then u need to place the class file of ur bean in C:/Program Files/New Atlanta/ServletExec API/classes directory.Also Do not forget to replicate the package structure for the class in above directory..
I think this should solve ur problem since i just now faced the same problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic