日期:2014-05-18  浏览次数:20685 次

“The value for the useBean class attribute XXX is invalid” 怎么解决?
bean  
package   beans;
import   java.sql.*;
public   class   connDB
{

Connection   conn=null;
Statement   stmt=null;
ResultSet   rs=null;
public   connDB()
{
try{
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ");
}
catch(java.lang.ClassNotFoundException   e)
{
System.err.println(e.getMessage());
}
}

public   ResultSet   executeQuery(String   sql)
{
try  
{
conn=DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;user=sa;password= ");
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sql);
}
catch(SQLException   ex)
{
System.err.println(ex.getMessage());
}
return   rs;
}
public   int   executeUpdate(String   sql)
{
int   result=0;
try
{
conn=DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;user=sa;password= ");
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
result=stmt.executeUpdate(sql);
}
catch(SQLException   ex)
{
//System.err.println(ex.getMessage());
result=0;
}
return   result;
}
}
一放在jsp中就提示出错,到底是那里错了呢?

------解决方案--------------------
類怎麽不大寫呢
不夠規範哦