javaBean 的问题。。希望大家看看!(在线等)

cocohui 2004-09-04 04:29:48
我有段代码!
opendb.java
package shenlan;
import java.sql.*;
public class opendb
{
Connection con;
Statement sql;
ResultSet rs;
public void opendb()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
System.err.println("opendb():"+e.getMessage());
}
}
public ResultSet executeQuery(String str)
{
try{
con=DriverManager.getConnection("jdbc:odbc:newworld","sa","tanhehui");
sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=sql.executeQuery(str);
}
catch(SQLException ex)
{}
return rs;


}
}
****test.jsp****
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*,java.io.*,newworld.opendb" %>
<jsp:useBean id="newworld" class="newworld.opendb" scope="page" />
<%
ResultSet rs=newworld.executeQuery("select * from student");
String kk;
while(rs.next())
{
kk=rs.getString("name");
out.print(kk);
}
rs.close();
%>
************报错如下*************
org.apache.jasper.JasperException: /admin/text.jsp(3,0) The value for the useBean class attribute newworld.opendb is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1225)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3269)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

我认为好奇怪。。这样的小问题都有。。

谁解决谁的分
...全文
34 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
bobshi 2004-09-04
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*,java.io.*,shenlan.opendb" %>
<jsp:useBean id="newworld" class="shenlan.opendb" scope="page" />
回复
skyboy0720 2004-09-04
<jsp:useBean id="newworld" class="newworld.opendb" scope="page" />
改成
<jsp:useBean id="newworld" class="shenlan.opendb" scope="page" />
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2004-09-04 04:29
社区公告
暂无公告