rs.next()返回值的奇怪问题?
我想实现select数据库里面的记录如果为null返回qqq,如果有记录择显示数据。
判断的时候检测rs1.next()是否为真可以区别是否存在记录。可是为什么当有数据时只显示一条?
try{
con=DBConnection.getConnection();
Statement stmt=con.createStatement();
ResultSet rs1=stmt.executeQuery( "select * from users where department= ' "+session.getAttribute( "department ").toString()+ " ' and duty= '5 ' and status= '0 ' ");
//System.out.print(rs1.next());
if(!rs1.next()){%>
<tr> <td> 提交对象: </td> <td colspan= "3 "> qqq </td> </tr>
<%}else{%>
<form action= "finish_send.jsp " name= " ">
<tr> <td> 提交对象: </td> <td colspan= "3 ">
<%while(rs1.next()){%>
<input type= "radio " name= "object " value= " <%=rs1.getString( "users_id ")%> "/> <%=rs1.getString( "realname ")%>
<%}%>
</td> </tr>
<tr> <td colspan= "4 " align= "center ">
<input type= "hidden " name= "app_id " value= " <%=session.getAttribute( "id ").toString()%> "/>
<input type=reset align= "middle " value= " 重 设 " &nb