我自己在做一个新闻发布系统,不太会用eclipse
错误信息为:
/WebRoot/index.jsp(3,0) The value for the useBean class attribute com.DBcon is invalid.
我的index页面为:
<%@ page contentType= "text/html; charset=gb2312 " language= "java " errorPage= " "%>
<%@ page import= "java.sql.* "%>
<jsp:useBean id= "db " class= "com.DBcon "/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<title> 新闻发布 </title>
<meta http-equiv= "pragma " content= "no-cache ">
<meta http-equiv= "cache-control " content= "no-cache ">
<meta http-equiv= "expires " content= "0 ">
<meta http-equiv= "keywords " content= "keyword1,keyword2,keyword3 ">
<meta http-equiv= "description " content= "This is my page ">
</head>
<body>
<table align= "center " bgcolor= "#ffff80 ">
<tr>
<td> 新闻标题
</td>
<td> 发布人
</td>
<td> 发布时间
</td>
<td>
</td>
</tr>
<%
String sql= "select * from newspub ";
ResultSet rs=db.executeQuery(sql);
%>
<%
String title=rs.getString( "newsTitle ");
String content=rs.getString( "newsContent ");
%>
<tr>
<td>
<%=title%>
</td>
<td>
<%=content%>
</tr>
</table>
<%db.closeCon();%>
</body>
</html>
我的bean是:
package com;
import java.sql.*;
public class DBcon {
String Dbdriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String strcon = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=newspub ";
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String user = "sa ";
String password = " ";
public DBcon() {
try {
Class.forName(Dbdriver);
} catch (ClassNotFoundException e) {