严重异常问题??急!!!!
请问这个是什么异常啊??javax.servlet.ServletException: com.microsoft.jdbc.sqlserver.SQLServerConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.post_jsp._jspService(post_jsp.java:118)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
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)
root cause
java.lang.AbstractMethodError: com.microsoft.jdbc.sqlserver.SQLServerConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
org.apache.jsp.post_jsp._jspService(post_jsp.java:63)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
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)
代码1:(post.jsp)
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.sql.*"%>
<%
request.setCharacterEncoding("GB2312");
try
{
String action=request.getParameter("action");
if("post".equals(action))
{
String title=request.getParameter("title");
String cont=request.getParameter("cont");
cont=cont.replaceAll("\n","<br>");
String DBDRIVER="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String DBURL="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=Javapet;SelectMethod=cursor";
String sql="insert into lunTan(pid,rootid,title,cont,pdate,isleaf) values(0,?,?,?,'2008',0)";
Class.forName(DBDRIVER);
Connection conn=DriverManager.getConnection(DBURL,"sa","123456");
conn.setAutoCommit(false);
PreparedStatement ps=conn.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
Statement stm=conn.createStatement();
ps.setInt(1,-1);
ps.setString(2,title);
ps.setString(3,cont);
ps.executeUpdate();
ResultSet rsKey=ps.getGeneratedKeys();
rsKey.next();
int Key=rsKey.getInt(1);
rsKey.close();
stm.executeUpdate("update lunTan set rootid="+Key+"where id="+Key);
();
conn.setAutoCommit(true);
stm.close();
ps.close();
conn.close();
response.sendRedirect("show.jsp");
}
}
catch(Exception e)
{
e.printStackTrace();
}
%>
<html>
<body>
<center>
<form action="post.jsp" method="post">
<input type="hidden" name="action" value="post">
<table border=1>
<tr>
<td align="center"><input type="text" name="title" size="81"</td>
</tr>
<tr>
<td><textArea cols=80 rows=15 name="cont"></textArea></td>
</tr>
<tr>
<td align="center"><input type="submit" value="提交"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
代码2:(show.jsp)
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.sql.*"%>
<%
String DBDRIVER="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String DBURL="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=Javapet";
Class.forName(DBDRIVER);
Connection conn=DriverManager.getConnection(DBURL,"sa","123456");
PreparedStatement ps=conn.prepareStatement("select * from lunTan where pid=0");
ResultSet rs=ps.executeQuery();
%>
<html>
<body>
<a href="post.jsp">发表新帖</a>
<table border=1>
<%
while(rs.next())
{
%>
<tr>
<td><%=rs.getInt("id")%></td>
<td><%=rs.getString("cont")%></td>
</tr>
<%
}
rs.close();
ps.close();
conn.close();
%>
</table>
</body>
</html>
[[it] 本帖最后由 Javapet 于 2008-5-8 01:22 编辑 [/it]]