| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 511 人关注过本帖
标题:[求助]关闭时出错!
取消只看楼主 加入收藏
kingyor
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-6-4
收藏
 问题点数:0 回复次数:1 
[求助]关闭时出错!


//JSP程序

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>调查结果</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
body {
margin: 4px;
padding: 2px;
}
-->
</style>
</head>
<body>
<%
try{
Class.forName("org.gjt.mm.mysql.Driver");
//加载 mm.mysql.driver
} catch (java.lang.ClassNotFoundException e)
//如果加载时出错,给出相应的错误信息
{
out.print("Class not found exception occur. Message is:");
out.print(e.getMessage());
}
try{
Connection con=null;
ResultSet rs=null;
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/vote?user=root&password=123");
Statement stmt=con.createStatement();
rs = stmt.executeQuery("SELECT * FROM vote");
if(!rs.next())
{out.print("<center>还没有人来投票</center>");
}else{
int all=rs.getInt("num");
int a1=rs.getInt("a1");
int a2=rs.getInt("a2");
int a3=rs.getInt("a3");
int a4=rs.getInt("a4");
int a5=rs.getInt("a5");
int a6=rs.getInt("a6");
int a7=rs.getInt("a7");
int a8=rs.getInt("a8");
int a9=rs.getInt("a9");
int a10=rs.getInt("a10");
int a11=rs.getInt("a11");%>
<table width="71%" height="380" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>调查结果:</td>
<td width="80%" height="20" align="left">  总共:<span class="STYLE1">
<%=rs.getInt("num")%></span>人参加投票</td>
<td width="8%" align="right">&nbsp;</td>
</tr>
<tr>
<td height="20" colspan="3">1.您认为我这人好吗?:</td>
</tr>
<tr>
<td width="12%">
好</td>
<td height="20" colspan="2"><img src="vb.gif" width=<%=a1%> height="10" /></td>
</tr>
<tr>
<td>不好</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a2%> height="10" /></td>
</tr>
<tr>
<td>不知道</td>
<td height="20" colspan="2"><img src="vb.gif" width=<%=a3%> height="10" /></td>
</tr>
<tr>
<tr>
<td height="20" colspan="3">2.您觉得你很了解我吗?:</td>
</tr>
<tr>
<td>是</td>
<td height="20" colspan="2"><img src="vb.gif" width=<%=a4%> height="10" /></td>
</tr>
<tr>
<td>否</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a5%> height="10" /></td>
</tr>
<tr>
<td height="20" colspan="3">3.您认为我们的关系:</td>
</tr>
<tr>
<td>好</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a6%> height="10" /></td>
</tr>
<tr>
<td>一般</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a7%> height="10" /></td>
</tr>
<tr>
<td>不好</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a8%> height="10" /></td>
</tr>
<tr>
<td>不知道</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a9%> height="10" /></td>
</tr>
<tr>
<td height="20" colspan="3">4.您是否希望我们的关系再好一点吗:</td>
</tr>
<tr>
<td height="17">是</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a10%> height="10" /></td>
</tr>
<tr>
<td height="18">否</td>
<td height="20" colspan="2">
<img src="vb.gif" width=<%=a11%> height="10" /></td>
</tr>
<tr>
<td height="9" colspan="3" align="left" class="STYLE1">。。。。。。。。。。。。K中心制作。。。。。。。。。。。。。。。</td>
</tr>
<tr>
<td height="47" colspan="3" align="center" class="STYLE1"><a href="javascript:window.close()">关闭窗口</a></td>
</tr>
</table><%}
}
catch (SQLException e) {
out.print("SQL Exception occur. Message is:");
out.print(e.getMessage());
}%>
<%
rs.close();
stmt.close();
con.close();
%>//这里他说错了!
</body>

</html>

500 Servlet Exception
/01/show.jsp:135: cannot resolve symbol
symbol : variable rs
location: class _jsp._01._show__jsp
rs.close();
^
/01/show.jsp:136: cannot resolve symbol
symbol : variable stmt
location: class _jsp._01._show__jsp
stmt.close();
^
/01/show.jsp:137: cannot resolve symbol
symbol : variable con
location: class _jsp._01._show__jsp
con.close();
^
3 errors


搜索更多相关主题的帖子: DTD dtd java xhtml 
2006-12-14 11:20
kingyor
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-6-4
收藏
得分:0 

谢谢!谢谢~一定改正!JAVABEAN的运行原理还不太明了,还在努力啊!


宝哥啊宝哥~~命苦啊命苦啊~~~
2006-12-14 22:31
快速回复:[求助]关闭时出错!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018263 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved