你现在数据库中的数据共2页吧!再多加点数据,第2页也应该不正常!
如果我没看错的话
do
{
}
while(rs.next())
中间没有限定语句,一直到结尾了。 如果采用do{}while应该中间加跳转语句。

解决方案 »

  1.   

    错误发生在下面的代码中:
    rs.absolute(currindex);
    if(totalpage==0)
    currpage=0;
    do{
    int id=rs.getInt(1);
    String title=rs.getString(2);
    String author=rs.getString(4);
    Date postime=rs.getDate(5);%>
      <tr bgcolor="#ccccff">
      <td height="30"><font color="#0000ff"><b><%=id%></b></font></td>
      <td height="30"><font color="#0000ff"><b><%=title%></b></font></td>
      <td height="30"><font color="#0000ff"><b> <%=author%></b></font></td>
      <td height="30"><font color="#0000ff"><b> <%=postime%></b></font></td>
    </tr>
    <tr bgcolor="#ffffff" align="left" valign="top">
      <td><font color="#0000ff"></font></td>
    </tr>
    <%

    }while(rs.next());
    你开始把游标定位在currindex rs.absolute(currindex);是对的
    但你没有给出结束行,应该每页都要给出一个结束,即每页都有开始行与结束行,显示的内容为从开始行到结束行。
      

  2.   

    int nCount = 0;//添加内容
    do{
    nCount++;//添加内容 int id=rs.getInt(1);
    String title=rs.getString(2);
    String author=rs.getString(4);
    Date postime=rs.getDate(5);%>
    <tr bgcolor="#ccccff">
      <td height="30"><font color="#0000ff"><b><%=id%></b></font></td>
      <td height="30"><font color="#0000ff"><b><%=title%></b></font></td>
      <td height="30"><font color="#0000ff"><b> <%=author%></b></font></td>
      <td height="30"><font color="#0000ff"><b> <%=postime%></b></font></td>
    </tr>
    <tr bgcolor="#ffffff" align="left" valign="top">
      <td><font color="#0000ff"></font></td>
    </tr>
    <%}while(rs.next()&&nCount<10);//添加内容