在eclipse下不能用javabean
小弟初学JSP,现在正在用eclipse
我按照书上和到网上找的资料配置好了开发环境后,JSP却一直不能正常运行,但又发现不了错误,只能来麻烦大家了,请帮帮忙
下面是我写的两个JAVABEAN和JSP文件
package wen;
import java.sql.*;
import java.io.*;
import java.util.Properties;
public class DBConnection
{
private static String driver;
private static String serverURL;
private static String username;
private static String password;
private static Connection conn = null;
private static Statement stmt = null;
private static String connectionFileName= "connection.txt ";
private String str;
private static Object initLock = new Object();
public Connection getConn() {
return conn;
}
public static Connection getConnection()
{
if(conn == null){
synchronized(initLock){
loadProperties();
try{
Class.forName(driver);
}
catch(
ClassNotFoundException e){
System.out.println(e.toString());
}
try{
conn = DriverManager.getConnection(serverURL,username,password);
}
catch(
SQLException e){
System.out.println(e.toString());
}
}
}
return conn;
}
public static void loadProperties(){
Properties connectionAdmin = new Properties();
System.out.println( "连接配置文件: " + connectionFileName);
try{
connectionAdmin.load(new FileInputStream(connectionFileName));
}
catch(
IOException e){
System.out.println( "找不到文件 " + connectionFileName);
System.out.println(e.toString());
}
driver = (String)connectionAdmin.get( "driver ");
serverURL = (String)connectionAdmin.get( "serverURL ");
username = (String)connectionAdmin.get( "username ");
password = (String)connectionAdmin.get( "password ");
}
public static ResultSet exec(String sql){
ResultSet rs = null;
try{
if(conn == null){
getConnection();
}
Statement stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
}catch(SQLException ex){
ex.printStackTrace();
}
return rs;
}
}
package wen;
import java.sql.*;
public class IndexBean {
public ResultSet getMoban(){