wood burning stoves 2.0*
The moose likes Servlets and the fly likes import package problem??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "import package problem???" Watch "import package problem???" New topic
Author

import package problem???

darine darine
Ranch Hand

Joined: Mar 08, 2001
Posts: 43
Hi
what the settings of classpath with tomcat3.1 to access classes
directory?is it by default or what?
I have my files in the bottom of this message.
When i append the package name to the class name i do not need to import the package using the page directive. it works fine.
I've tried to put the bean java file in the beans directory under classes directory without "package beans;" statement and I've tried to run my jsp file,I still get the message can't load the bean class.
here my jsp file:
//=================
<%@ page import="beans.*" %>
<jsp:useBean id="stringBean" class="StringBean" />
<%-- <jsp:getProperty name="stringBean" property="message" /> --%
<jsp:setProperty name="stringBean" property="message" value="hello matt from new directories " />
<jsp:getProperty name="stringBean" property="message" /><br>
//===========================
Here is my bean java file:
//==========================
public class StringBean
{
private String message="No message specified ";
public void setMessage(String message)
{
this.message=message;
}
public String getMessage()
{
return this.message;
}
}
Revati Pathak
Greenhorn

Joined: Feb 19, 2001
Posts: 26
hi,
there are no special settings of classpath to access classes directory. but if you are putting your class file in classes/bean directory then you must include the statement package bean; in your java file. otherwise it will not be able locate your class file.
this is essential in both the cases whether you import the bean.* using Page directive or directly say <jsp:useBean id="stringBean" class="bean.StringBean" />
hope this will solve your problem.
-Revati
 
wood burning stoves
 
subject: import package problem???
 
Similar Threads
Setting up directory structure for Bean Component in JSP
Error - Please Help!!!
Where in Tomcat3.1 should i put .jsp files, .java files(Beans files)
classpath or package problems?
import package problems??