Hi, Kaustubh
you have two possibilties
1)  import your bean
<%@ page import="trial.TestBean" %>
2) or put your bean in a package "trial", so
in TestBean.java source file the first line is to be
"package trial;"
and the class file for TestBean.class is to placed in
/my_application_home/web-inf/classes/trial/TestBean.class
(as you have already done).
 
Regards,
Piotr K.
----- Original Message -----
From: kaustubh
Sent: Saturday, March 10, 2001 1:04 PM
Subject: JSP - Bean problem : plz help

Hi people,
I am a newbie to JSP / Servlets
I am trying to write a JSP which instantiates a Bean...
here is my code for the JSP :
<%@ page language="java"%>
<jsp:useBean id="testBean" scope="session" class="trial.TestBean"/>
<jsp:setProperty name="testBean" property="height" value="15"/>
<html>
<head>
<title>Simple JSP Example</title>
</head>
<body>
<p>
<% for(int i=0;i<5;i++)
   {
%>
 Hello World !!<br>
<% } %>
This is my first bean example : <jsp:getProperty name="testBean" property="height"/>
</p>
</body>
</html>
 
I have written a TestBean class with package declaration as "trial" and put this class in
/my_application_home/web-inf/classes/trial/TestBean.class
 
When I startup Tomcat and I access my applications other .jsp pages which donot access beans, they work fine...
but when I access the above bean, it says, java.lang.ClassNotFoundException : trial.TestBean not found.
Now here is the climax....when I put this "trial" directory in tomcat_home/common/classes/
the bean is found and the jsp executes perfectly....
why is it so??
I want to start development on a small project and cant find a way to solve this problem....
Please would u help me?
 
Thanks & Best Regards,
Kaustubh Vaze
Internet Programmer
[EMAIL PROTECTED]
Kaustubh Vaze
Internet Programmer
[EMAIL PROTECTED]

Reply via email to