<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030" import="java.sql.*"%> Insert title here
 
<% int CountPage = 0; int CurrPage = 1; int PageSize = 12; int CountRow = 0; String StrPage = request.getParameter("Page"); if (StrPage == null) { CurrPage = 1; } else { CurrPage = Integer.parseInt(StrPage); } Connection con=gg.getCon(); if (con != null) { try { String sqlyy = "Select * from gg "; ResultSet rs=gg.GetRs(sqlyy); if(!rs.next()) { out.println("对不起,暂时没有信息"); } else{ rs.last(); int i = 0; CountRow = rs.getRow(); CountPage = (CountRow/PageSize); if (CountRow%PageSize>0) CountPage++; Integer n = (CurrPage-1)*5+1; rs.first(); rs.absolute(CurrPage*PageSize-PageSize+1); while (i <% rs.next(); i++; } } } catch (SQLException e) { out.println(e.getMessage()); } finally { con.close(); } } %>
标题 内容 时间
<%=rs.getString("Gg_titile")%> <%=rs.getString("Gg_neirong")%> <%=rs.getString("shijian")%>
[<%=CurrPage%>/<%=CountPage %>] 每页<%=PageSize %>条 共<%=CountRow%>条记录
<% for (int i = 1;i<=CountPage;i++){%> [<%=i%>] <%}%>