jsp中要使用的java类调试出通不过?高手请帮忙,急急急,在线等!谢谢!!!

pipilu1978 2003-07-25 12:38:31
我的一个JSP页面要调用java类,类的存放路径是%TOMCAT_HOME%\webapps\Book\WEB-INF\classes\scripting,scripting目录中有两个类Expense.java和ExpenseReport.java,前者能通过调试,后者要调用到前者,但在DOS下编译后者老是出错——是Expense类未定义,到底是怎么问题?我把ExpenseReport.java的代码贴上来,高手请指点,谢谢!package scripting;

import java.util.List;
import java.util.ArrayList;

public class ExpenseReport {
private static ExpenseReport expRpt_ = null;

static {
List exp = new ArrayList();
exp.add(new Expense("01/01/2000", "Dr. Jeffers", Expense.MEDICAL, 5));
exp.add(new Expense("01/02/2000", "Hoyts Cinema", Expense.ENTERTAINMENT, 15));
exp.add(new Expense("01/02/2000", "Pepco", Expense.ELECTRICITY, 34.83));
exp.add(new Expense("01/05/2000", "Giant Foodstore", Expense.GROCERIES, 90.45));
exp.add(new Expense("01/05/2000", "Baja Fresh", Expense.DINING, 22.65));
exp.add(new Expense("01/05/2000", "Mobil", Expense.GAS, 20.61));
exp.add(new Expense("01/05/2000", "Chipotle Mexican Grill", Expense.DINING, 16.65));
exp.add(new Expense("01/07/2000", "BlockBuster Video", Expense.ENTERTAINMENT, 7.45));
exp.add(new Expense("01/07/2000", "Ill Pizzico", Expense.DINING, 16.64));
exp.add(new Expense("01/13/2000", "Sunoco", Expense.GAS, 18.49));
exp.add(new Expense("01/13/2000", "Dr. Hundemer", Expense.MEDICAL, 10));
exp.add(new Expense("01/15/2000", "Mama Lucia's", Expense.DINING, 14.89));
exp.add(new Expense("01/16/2000", "Safeway", Expense.GROCERIES, 55.25));
exp.add(new Expense("01/23/2000", "Sheetz", Expense.GAS, 15.46));
exp.add(new Expense("01/23/2000", "Flu Shots", Expense.MEDICAL, 20));
exp.add(new Expense("01/27/2000", "Pepco", Expense.ELECTRICITY, 63.56));
exp.add(new Expense("01/27/2000", "Madras Palace", Expense.DINING, 25.50));
exp.add(new Expense("01/29/2000", "Safeway", Expense.GROCERIES, 40.20));
exp.add(new Expense("01/30/2000", "BlockBuster Video", Expense.ENTERTAINMENT, 4.40));

expRpt_ = new ExpenseReport("January", exp);
}

public static ExpenseReport getReport() {
return expRpt_;
}

private List expenses_ = null;
private String month_ = null;

public ExpenseReport(String month, List expenses) {
month_ = month;
expenses_ = expenses;
}

public List getExpenses() {
return expenses_;
}

public String getMonth() {
return month_;
}
}

...全文
8 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
cshchina 2003-07-25
classpath里加了当前路径了吧?
回复
wangyanqiu 2003-07-25
up

回复
ejbcreate 2003-07-25
估计是classpath的问题,有两种方法解决这个问题:

1)试试用下面的命令编译:

javac -classpath %TOMCAT_HOME%\webapps\Book\WEB-INF\classes ExpenseReport.java

2)把%TOMCAT_HOME%\webapps\Book\WEB-INF\classes 加到CLASSPATH里:
CLASSPATH=%TOMCAT_HOME%\webapps\Book\WEB-INF\classes;
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2003-07-25 12:38
社区公告
暂无公告