菜鸟问个问题, 请大侠帮忙!!1
我写了java程序如下:
package myclass;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import myclass.ConnectSql;//这是我写的一个java程序便宜后class文件放在myclass文件里
public class Lookup {
String goodsname;
String introduction;
String unit;
String company;
Float price;
Integer total;
Statement stmt=null;
ResultSet st=null;
String sql="select goodsname,introduction,unit,company,price,total from goods";
public void excuteQury(){
try{
st=stmt.executeQuery(sql);
when(st.next()){
application.setAttribute("goodsname",st.getString("goodsname"));
application.setAttribute("introduction",st.getString("introduction"));
application.setAttribute("unit",st.getString("unit"));
application.setAttribute("company",st.getString("company"));
application.setAttribute("price",st.getString("price"));
application.setAttribute("total",st.getString("total"));
}
}catch(SQLException e){
System.out.println("the sql error:"+e.getMessage())
}
stmt.close();
st.close();
}
}
在DOS下javac Lookup.java
结果问题一大堆
说找不到javax.servlet.*;
javax.servlet.http.*;
java.sql.*;
myclass.ConnectSql;
说他们不存在!!!!
我不是想写servlet程序, 我之所以想调用那些类,是想用request和application来与页面传递参数值
我在网上找了一下, 说要把TOMCAT的servlet.jar的路径放在classpath里面
我放了啊, 但是还是找不到哪几个类
还有classpath里面的路径我设置的东西比交长
结果我运行autoexec.bat,
他说:Out of environment space 怎么设置CLASSPATH
我的系统是98 CLASSPATH如下:
set classpath=.;d:\jdk1.4\lib\tools.jar;d:\tomcat4.1\common\lib\servlet.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar
问题太多了, 请大狭费点心啊
问题点数:0、回复次数:4Top
1 楼sjssunjs(大海)回复于 2004-09-01 18:28:43 得分 0
是98啊!!这么老啊!其实就是你路径没配对,如果对了,其他问题就没了!!Top
2 楼freedom1980(力促)回复于 2004-09-01 18:33:28 得分 0
现在好能找到那几个类
但是我的myclass.ConnectSql却找不到啊
怎么回事Top
3 楼zjpangxie(专用马甲)回复于 2004-09-01 18:36:12 得分 0
Lookup和ConnectSql在同一个包下,不用import
另外:
when(st.next()){ ?????
application.setAttribute("goodsname",st.getString("goodsname")); ????
-_-
Top
4 楼freedom1980(力促)回复于 2004-09-01 18:47:06 得分 0
application 怎么再定义
我写了个
ServletContext application;
行不Top




