错误提示:
org.apache.jasper.JasperException: An exception occurred processing JSP page /save_class.jsp at line 15
12: <body>
13: <%
14: classBean.setClassInfo(class_Info);
15: classBean.classAdd();
16: %>
17: </body>
18: </html>
javax.servlet.ServletException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'Class_Table ' 无效。
以下是源码:
ConDatabase.java
package test;
import java.sql.*;
public class ConDatabase
{
public static Connection getConn()
{
String classForName = "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String servAndDB = "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabsaeName=jsp_test ";
String user = "sa ";
String passWord = "cn&2008 ";
Connection conn = null;
try
{
Class.forName(classForName);
conn =DriverManager.getConnection(servAndDB,user,passWord);
}
catch(Exception e)
{
e.printStackTrace();
}
return conn;
}
}
view_class.jsp
<%@ page language= "java " contentType= "text/html;charset=gb2312 " import= "java.sql.* " %>
<jsp:useBean id= "database " class= "test.ConDatabase " scope= "page "/>
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
</head>
<body>
<%
Connection conn=database.getConn();
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql= "select Class_ID,Class_Name from Class_Table ";