<% @ page contentType = " text/html;charset=gb2312 " %> <% @ page import = " java.sql.* " %> < jsp:useBean id = " connBean " class = " beans.ConnDB " scope = " page " /> <% ResultSet rs = connBean.executeQuery( " select * from user_info " ); System.out.println( " 分页开始 " ); ResultSet rs1 = connBean.executeQuery( " select count(*) from user_info " ); System.out.println( " select count " ); if (rs1.next()) ... { String MaxRowLine=rs1.getString(1); System.out.println("获得最大行数"); int MaxRow=Integer.parseInt(MaxRowLine);//最大行数 System.out.println("MaxRow="+MaxRow); int PageSize=5;//每页显示记录 int PageCount=(MaxRow%PageSize==0)?(MaxRow/PageSize):(MaxRow/PageSize+1);//最大页数 //System.out.println String StrPage=request.getParameter("Page");//获得当前页数 if(StrPage==null)...{StrPage="0";} int Page=Integer.parseInt(StrPage); if(Page<1)...{ Page=1; } else...{ if(((Page-1)*PageSize+1)>MaxRow)...{ Page=PageCount; } } System.out.println("都发生到访第三方"); String sql="select top "+PageSize+" * from user_info where (id not in (select top "+(Page-1)*PageSize+" id from user_info)) order by id"; System.out.println(sql); ResultSet rs2=connBean.executeQuery(sql); System.out.println("dfdsfdsafdsafkllkjk"); for(int i=1;i<=PageSize;i++) ...{try ...{if(!rs2.next())...{break;} }catch(Exception e)...{System.err.println(e.toString());}%> <%=rs2.getString("username")%><% }%>当前页数:[<%=Page%>/<%=PageCount%>] <%if(Page>1)...{%> <a href="top.jsp?Page=1">第一页</a> <a href="top.jsp?Page=<%=Page-1%>">上一页</a><% } if(Page<PageCount)...{%> <a href="top.jsp?Page=<%=Page+1%>">下一页</a> <a href="top.jsp?Page=<%=PageCount%>">最后一页</a> <%}} %>