“The value for the useBean class attribute XXX is invalid” 怎么解决?

sjshuang1 2007-04-09 07:39:32
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中就提示出错,到底是那里错了呢?
...全文
655 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
breezemylife 2011-05-01
  • 打赏
  • 举报
回复
同样的问题
怎么解决的?
8楼的方法还是不行
wangyangybs 2009-11-11
  • 打赏
  • 举报
回复
结贴了。。。
不过最近也遇到这个问题搞了很久,组后发现是class属性那里没有填完整名。我是用import导入的类,所以class属性处只写了类名,这样的话tomcat是找不到类的。解决办法就是class处填写完整名称如:com.xxx.xxx.className。
sjshuang1 2007-11-02
  • 打赏
  • 举报
回复
什么都不说了结贴
lsj19830812 2007-04-09
  • 打赏
  • 举报
回复
類怎麽不大寫呢
不夠規範哦
sjshuang1 2007-04-09
  • 打赏
  • 举报
回复
jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>欢迎</title>
</head>

<body>
</body>
</html>
<%@ page import="java.sql.*"errorPage=""%>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<jsp:include page="counter.jsp"/>
sjshuang1 2007-04-09
  • 打赏
  • 举报
回复
ype Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /web/top1.jsp(13,0) The value for the useBean class attribute beans.connDB 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)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
newbinmaster 2007-04-09
  • 打赏
  • 举报
回复
把错误贴出来啊
sjshuang1 2007-04-09
  • 打赏
  • 举报
回复
伤口上洒盐,我用字典查也查的出是什么意思!
tomcat重起也不行
zqpsswh 2007-04-09
  • 打赏
  • 举报
回复
这么简单的英文都不懂?

那你学什么编程

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧