52dumpling
发贴: 8
积分: 1
|
于 2005-07-24 08:40
testmysql.jsp文件代码如下: <%@ page contentType="text/html;charset=GB2312" %> <%@ page language="java" import="java.sql.*"%> <% java.sql.Connection conn; java.lang.String strConn; Class.forName("org.gjt.mm.mysql.Driver").newInstance(); conn= java.sql.DriverManager.getConnection("jdbc:mysql://192.168.10.2:8080/test","root","admin"); statement stmt=conn.createStatement(); ResultSet rs=null; rs=stmt.executeQuery("select * from test"); %> 放在root目录下运行结果如下: org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 3 in the jsp file: /testmysql.jsp Generated servlet error: D:\Program Files\Tomcat\work\Catalina\localhost\_\org\apache\jsp\testmysql_jsp.java:50: cannot find symbol symbol : class statement location: class org.apache.jsp.testmysql_jsp statement stmt=conn.createStatement(); ^ 1 error
说明: 我的环境变量设置: classpath .;D:\Program Files\jdk1.5\lib\tools.jar;D:\Program Files\jdk1.5\lib\dt.jar;D:\Program Files\Tomcat\common\lib\servlet-api.jar;D:\Program Files\Tomcat\common\lib\jsp-api.jar;D\Program Files\jdk1.5\lib\mm.mysql-2.0.4-bin.jar
path D:\Program Files\jdk1.5\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;D:\Program Files\MySQL\bin;
JAVA_HOME D:\Program Files\jdk1.5\bin
CATALINA_HOME D:\Program Files\Tomcat
CATALINA_BASE D:\Program Files\Tomcat
用javac运行helloword.java都是正常的 我还把tools.jar和dt.jar都放在tomcat\common\lib 和jdk1.5\lib目录下了 mysql的驱动文件mm.mysql-2.0.4-bin.jar我也同时放在上面两个目录下了 我安装的是jdk1.5+mysql4.1+tomcat5.0.28
薄醉不成乡,转觉春寒重。枕席有谁同?夜夜和愁共。 梦好恰如真,事往翻如梦。起立悄无言,残月生西弄。
|