日期:2014-05-18  浏览次数:20754 次

一个星期也没解决。真的感觉自己很失败呀!!!!!!!!
使用环境: 
winxp 
Tomcat/5.5.26 
j2sdk 1.5 

SQL server 2000 打了SP4补丁 
安装了Microsoft SQL Server 2000 Driver for JDBC sp3 
WEB-INF\lib下也放了jar包。平常的数据库连接都可以。 

这是个书中的例子,做时出现问题: 


<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %> 
<jsp:useBean id="conn" scope="page" class="com.ConnDB"/> 
<% 
String sql="select * from tb_branch"; 
ResultSet rs=conn.executeQuery(sql); 
%> 
<html> 
<head> 
<title>选择所有列 </title> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<link href="CSS/style.css" rel="stylesheet"> 
</head> 

<body> 
<table width="600" height="201" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> 
  <tr> 
  <td height="201" valign="top"> 
<table width="100%" height="77" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#FFFFFF" bordercolorlight="#666666"> 
  <tr style="padding:5px;"> 
  <td height="24" colspan="4" align="center" bgcolor="#CCCCCC">≡≡≡ 部门全部信息 ≡≡≡ </td> 
  </tr> 
  <tr> 
  <td width="18%" height="27" align="center"> ID号 </td> 
  <td width="36%" align="center">部门名称 </td> 
  <td width="20%" align="center">联系电话 </td> 
  <td width="8%" align="center">备注 </td> 
  </tr> 
  <% 
try{ 
while(rs.next()){ 
  %> 
  <tr style="padding:5px;"> 
  <td height="24" align="center"> <%=rs.getInt("id")%> </td> 
  <td align="center"> <%=rs.getString("name")%> </td> 
  <td align="center"> <%=rs.getString("tel")%> </td> 
  <td align="center"> <%=rs.getString("memo")%> </td> 
  </tr> 
  <% 

}catch(Exception e){} 
%> 
  </table> </td> 
  </tr> 
</table> 
</body> 
</html> 


错误如下: 
HTTP Status 500 - 

-------------------------------------------- 

type Exception report 

message 

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

exception 

org.apache.jasper.JasperException: Unable to load class for JSP 
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:599) 
org.apache.jasper.servlet.JspServletWrapper.