jsp关于ResultSet的问题
请高手看一下那里错了!<bodyleftmargin="0"topmargin="0"marginwidth="0"marginheight="0"><tablewidt...
请高手看一下那里错了!
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td background="Images/bg_td.gif" height="25" colspan="4"> <strong><font color="#FFFFFF">文章分类管理</font></strong>
<input type="submit" name="Submit" value="增加一个新分类" /> </td>
</tr><%ResultSet res;
String sql="select * from JK_NewsFlA order by id desc";
res=stmt.executeQuery(sql);
while(res.next()){%>
<tr bgcolor="#F3F3F3">
<td width="70%" height="22"> <img src="Images/bullet.gif" width="15" height="20" /> <%=res.getString("flname")%></td>
<td width="10%">
<div align="center"><a href='artfladda.jsp?flid=<%=res.getInt("id")%>'>增加</a></div></td>
<td width="10%">
<div align="center"><a href='artfledita.jsp?flid=<%=res.getInt("id")%>'>编辑</a></div></td>
<td width="10%">
<div align="center"><a href='artfldela.jsp?flid=<%=res.getInt("id")%>'>删除</div></td>
</tr><%int ad=res.getInt("id");
ResultSet asd;
String sqla="select * from JK_NewsFlB where aid="+ ad +"";
asd=stmt.executeQuery(sqla);
while(asd.next()){%>
<tr bgcolor="#F3F3F3">
<td height="22"> <img src="Images/bullet.gif" width="15" height="20" /></td>
<td>
<div align="center">增加</div></td>
<td>
<div align="center">编辑</div></td>
<td>
<div align="center">删除</div></td>
</tr><%}%>
<tr bgcolor="#F3F3F3">
<td height="22"> <img src="Images/bullet.gif" width="15" height="20" /></td>
<td>
<div align="center"></div></td>
<td>
<div align="center">编辑</div></td>
<td>
<div align="center">删除</div></td>
</tr><%
}
res.close();
stmt.close();
%></table>
</body>
</html>
以下是错误日志
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /newsfl.jsp:16
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs. 展开
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td background="Images/bg_td.gif" height="25" colspan="4"> <strong><font color="#FFFFFF">文章分类管理</font></strong>
<input type="submit" name="Submit" value="增加一个新分类" /> </td>
</tr><%ResultSet res;
String sql="select * from JK_NewsFlA order by id desc";
res=stmt.executeQuery(sql);
while(res.next()){%>
<tr bgcolor="#F3F3F3">
<td width="70%" height="22"> <img src="Images/bullet.gif" width="15" height="20" /> <%=res.getString("flname")%></td>
<td width="10%">
<div align="center"><a href='artfladda.jsp?flid=<%=res.getInt("id")%>'>增加</a></div></td>
<td width="10%">
<div align="center"><a href='artfledita.jsp?flid=<%=res.getInt("id")%>'>编辑</a></div></td>
<td width="10%">
<div align="center"><a href='artfldela.jsp?flid=<%=res.getInt("id")%>'>删除</div></td>
</tr><%int ad=res.getInt("id");
ResultSet asd;
String sqla="select * from JK_NewsFlB where aid="+ ad +"";
asd=stmt.executeQuery(sqla);
while(asd.next()){%>
<tr bgcolor="#F3F3F3">
<td height="22"> <img src="Images/bullet.gif" width="15" height="20" /></td>
<td>
<div align="center">增加</div></td>
<td>
<div align="center">编辑</div></td>
<td>
<div align="center">删除</div></td>
</tr><%}%>
<tr bgcolor="#F3F3F3">
<td height="22"> <img src="Images/bullet.gif" width="15" height="20" /></td>
<td>
<div align="center"></div></td>
<td>
<div align="center">编辑</div></td>
<td>
<div align="center">删除</div></td>
</tr><%
}
res.close();
stmt.close();
%></table>
</body>
</html>
以下是错误日志
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /newsfl.jsp:16
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs. 展开
5个回答
展开全部
ResultSet asd 没有关闭,签套也错了,可能连使用RS的包都没有引进去,也没有建立连接
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
res=stmt.executeQuery(sql); stmt也没有申明啊.
还有asd 也没关闭,这不是个好习惯.
把编译成servelt的java文件贴出来会更好处理.
还有asd 也没关闭,这不是个好习惯.
把编译成servelt的java文件贴出来会更好处理.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可能是res没有关闭吧!
参考资料: 可能是res没有关闭吧!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
ResultSet asd
asd 没有关闭?
asd 没有关闭?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dsafdsafsadfsadf
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询