关于 while(rs.next()){问题!!!!!!
网页能够正常打开,也没有报错误,因为加了if(rs!=null)。可是网页打开后里面原本该出现的内容都没有出现,而且数据库连接正常,却无法登入。求救!!!
代码如下。
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*"%>
<jsp:useBean id="con" class="com.bwm.db.Conn" scope="page"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/default.css" rel="stylesheet" type="text/css">
</head>
<body background="images/bg.jpg">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="27" colspan="3" align="right"><div id="link"></div></td>
</tr>
<tr>
<td width="1" height="36" background="images/gbnavl.gif"></td>
<td width="99%" background="images/gbnavm.gif"><div id="link1"><a href="student/">学生注册</a> <a href="company/">企业注册</a></div></td>
<td width="1" background="images/gbnavr.gif"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50" bgcolor="#FFFFFF"><div id="top"><img src="images/top.gif" width="340" height="38"></div></td>
</tr>
</table>
<table width="100%" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" background="images/index_bg.jpg" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center" >
<td width="50%" height="22"><div id="font1">学生求职</div></td>
<td width="50%" height="22"><div id="font1">企业招聘</div></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
ResultSet rs=con.getRs("SELECT a.jobid,b.name,b.school,b.specialty,b.knowledge,a.job,a.emolument FROM tb_sjob AS a,tb_student AS b WHERE a.sname=b.sname and getdate()<=atime ORDER BY ptime DESC");
if(rs!=null)
{
while(rs.next()){
%>
<tr>
<td valign="top"><font id="reg"><<</font><a target="_blank" href="view.jsp?sid=<%=rs.getString(1)%>">[<%=rs.getString(2)%>]毕业于[<%=rs.getString(3)%>,<%=rs.getString(4)%>,<%=rs.getString(5)%>],欲求[<%=rs.getString(6)%>]职位,要求薪水[<%=rs.getString(7)%>]。</a> </td>
</tr>