小弟用javabean连数据库,从数据库中提取数据并显示在jsp 页面,数据源已建立,连接已经成功,但jsp页面提示如下错误
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /sfjs.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\TOMCAT\Tomcat 4.1\work\Standalone\localhost\gongshui\sfjs_jsp.java:46: package test does not exist
test.test test_bean = null;
^
An error occurred at line: 2 in the jsp file: /sfjs.jsp
Generated servlet error:
D:\TOMCAT\Tomcat 4.1\work\Standalone\localhost\gongshui\sfjs_jsp.java:48: package test does not exist
test_bean = (test.test) pageContext.getAttribute( "test_bean ", PageContext.PAGE_SCOPE);
^
An error occurred at line: 2 in the jsp file: /sfjs.jsp
Generated servlet error:
D:\TOMCAT\Tomcat 4.1\work\Standalone\localhost\gongshui\sfjs_jsp.java:51: package test does not exist
test_bean = (test.test) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "test.test ");
^
3 errors
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:248)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
我写的包已经编译并放在\WEB-INF\CLASSES文件夹下,代码:
package test;
import java.sql.*;
public class test
{
String sDBDriver= "sun.jdbc.odbc.JdbcOdbcDriver ";
Connection conn=null;
ResultSet rs=null;
Statement stmt=null;
int count;
public void Connect(){
try{
Class.forName(sDBDriver);
}
catch(java.lang.ClassNotFoundException e){