留言的显示问题-已生成用于更新的结果集
想把数据库的留言全部显示出来,可是抛出的异常是已生成用于更新的结果集
代码如下,求高手解决
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*,lyb.*"%>
<html>
<body>
<%
int id=0;
Connection conn = null ;
PreparedStatement pstm = null ;
ResultSet rs = null ;
%>
<%
String name = request.getParameter("name") ;
String zhuti = request.getParameter("zhuti") ;
String news = request.getParameter("news") ;
%>
<%
String sql = "SELECT id,name,zhuti,news FROM liuyan WHERE name like ? or zhuti like ? or news like ?" ;
try
{
conn = ConnectionManager.getConnection() ;
pstm = conn.prepareStatement(sql) ;
Statement statement=conn.createStatement();
pstm.setString(1,name) ;
pstm.setString(2,zhuti) ;
pstm.setString(3,news) ;
pstm.executeUpdate();
%>
<table border="1" width="100%" align="center">
<tr>
<td width="18%" height="25" align="center"><i>留言者</i></td>
<td width="22%" height="25" align="center"><i>主题</i></td>
<td width="40%" height="25" align="center"><i>留言内容</i></td>
<%
while(rs.next())
{
out.println("<TR><td align=center><font size=2>"+rs.getString("name")+"</TD>");
out.println("<TD><font size=2>"+rs.getString("zhuti")+"</font></TD>");
out.println("<TD><font size=2>"+rs.getString("news")+"</font></TD>");
}
rs.close();
conn.close();
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>
<a href="index.jsp">返回首页</font></a>
</table>
</body>
</html>
------解决方案--------------------
把异常添出来看看。。。