Meaningless Drivel is fun!
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

import package problem???

darine darine
Ranch Hand

Joined: Mar 08, 2001
Posts: 43
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)
public String getMessage()
return this.message;
Revati Pathak

Joined: Feb 19, 2001
Posts: 26
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.
I agree. Here's the link:
subject: import package problem???
It's not a secret anymore!