Paging program

xiaoxiao2021-03-06  20

INT INTPAGESIZE; // One page shows the number int intert ost; // record total int intelective; // Total number INT INTPAGE; // Terminal String strPage; int i; // Set one page displayed INTPAGESIZE = 6;

// Nourish the page number to be displayed StrPage = Request.getParameter ("page"); if (strpage == null) {// indicates that there is no page of Page in querystring, showing the first page data INTPAGE = 1;} else {// convert a string to integer = java.lang.integer.parseint (strpage); if (INTPAGE <1) INTPAGE = 1;} // Get record total RS.last (); introwcount = rs.Gtrow (); // 记 总 总 (INTPAGECUNT INTPAGESIZE-1) / INTPAGESIZE; // Adjust the page number if (INTPAGE> INTPAGECUNT) INTPAGE = INTPAGECUNT; if (INTPAGECUNT> 0) {// will record The pointer is positioned to the first record of the page to be displayed on RS.Absolute * INTPAGESIZE 1); // Display data i = 0; while (i

%>

HTML information <% rs.next (); i ; // Statistics Several records. // Read the post information End}%> // Display menu: example: Page 1 total 4 records / 1 page | Previous | Next | Last

<% = INTPAGE%> page A total of <% = INTROUNT%> Stroduc / Total <% = INTPAGECOUNT%> page <% IF (INTPAGE <2) {Out.print ("Home | Previous");} else { %> Home | Previous <%}%> | <% IF ((INTPAGECUNT-INTPAGE) <1) {OUT.PRINT ("Next | Last");} else {%> Next page | Tissue <%}} else {} (conn! = null) {conn.close ();} if (stmt! = null) {stmt.close ();}%>

转载请注明原文地址:https://www.9cbs.com/read-61103.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.036, SQL: 9