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

jsp连接Bean出错
org.apache.jasper.JasperException:   /login/login_confirm.jsp(10,0)   The   value   for   the   useBean   class   attribute   DB   is   invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Generator.generate(Generator.java:3394)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

拜托,帮忙解决下赖!
Bean的程序:package   DB;
import   java.sql.*;
public   class   DB
{
String   sDBDriver= "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String   sConnStr= "jdbc.microsoft.sqlserver ";
public   Connection   conn=null;
public   Statement   stmt;
        ResultSet   rs=null;
        String   url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Mythesis ";
String   user= "sa ";
String   password= "123 ";
             
  public   DB(){
  try{
  Class.forName(sDBDriver).newInstance();
  }
  catch(Exception   e){
  e.printStackTrace();
 
  }
 
  }  

 
public     ResultSet   executeQuery(String   sql)  
{
rs=null;

try{
 
  conn=DriverManager.getConnection(url,user,password);
  stmt=conn.createStatement();
  rs=stmt.executeQuery(sql);      
         
  }
 
          }

}
catch(SQLException   ex)
{
    System.out.print( "aq.executeQuery: "+e.getMessage());
         
}
return   rs;
}
public     void   executeupdate(String   sql)  
{
stmt=null;
rs=null;

try{
 
  conn=DriverManager.getConnection(url,user,password);
  stm