<% @ Page contenttype = "text/html; charset = gb2312" %> <% @ page Language = "Java" %> <% @ page import = "Java. SQL. * "%> <% // driver name, which is old. If you use mysql5, change it by yourself. String drivername = "org. gjt. mm. mySQL. driver "; string username =" root "; // database username string userpasswd =" 666666 "; // password string dbname =" Search "; // database name string tablename = "organizations"; // table name // connection string url = "JDBC: mysql: // localhost/" + dbname + "? User = "+ username +" & Password = "+ userpasswd; Class. forname (drivername ). newinstance (); connection = drivermanager. getconnection (URL); Statement statement = connection. createstatement (); // number of records displayed per page int pagesize = 30; int startrow = 0; // start to display the number of records int pageno = 0; // number of pages to be displayed int counterstart = 0; // The initial value of each page number int counterend = 0; // the maximum value of the displayed page number int recordcount = 0; // The total number of records; int maxpage = 0; // total number of pages int prevstart = 0 ;/ /INT nextpage = 0 on the previous page; // int lastrec = 0 on the next page; int laststartrecord = 0; // The number of records displayed on the last page. // obtain the number of pages to be displayed, if (request. getparameter ("pageno") = NULL) {// if it is null, it indicates page 1st if (startrow = 0) {pageno = startrow + 1; // set to 1} else {pageno = integer. parseint (request. getparameter ("pageno"); // obtain the number of pages submitted by the user. startrow = (pageno-1) * pagesize; // obtain the record number displayed at the beginning} // because the number of displayed page numbers changes dynamically, it is impossible to display one hundred links at the same time if there are 100 pages in total. Instead, the initial value of the displayed page number is displayed based on the current page number. // a certain number of page links are displayed. // the initial value of the displayed page number is displayed !! If (pageno % pagesize = 0) {counterstart = pageno-(pagesize-1);} else {counterstart = pageno-(pageno % pagesize) + 1 ;} counterend = counterstart + (pagesize-1 ); %> <HTML>