Efficient JSP paging query

xiaoxiao2021-03-06  99

JSP is as follows: ********************* <% @ page language = "java" import = "java.util. *, Java.sql. *"% > <% @ Page ContentType = "Text / HTML; Charset = GB2312"%> <% int curpage = 1; // Current page INT Page_Record = 20; // The number of records displayed per page // Use the following method (SQL query is completed, fast) CURPAGE = Integer.Parseint (Request.GetParameter ("page")))); // Get the delivered value, page ResultSet RS = cn.rsexecuteQuery ("SELECT TOP" Page_Record "* from Tablename Where ID NOT IN (SELECT TOP) " (CURPAGE * PAGE_RECORD) " ID from Tablename Order By ID "); // This query statement is obtained by 20 records of the 1000 pages you want to display, and the rough ideas are - subquery exclude All records before the records need to be displayed, the parent query is descended in descending of the remaining records for the remaining records (rs.next) {Out.println (rs.getint ("ID"). TOSTRING ());}}}}}}}}}}}}}}}}}}}}}}} Rs.close () ;%>

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

New Post(0)