This article describes in detail how to use JQuery to write a simple asynchronous paging plug-in. If you are interested, you can refer to a Jquery asynchronous paging plug-in and share it with you, please advise if there are any imperfections.
Take the user paging as an example. Let's take a look at the effect first, which is the first page:
Next page or click Next page:
After clicking the last page:
Is the effect okay? To see how to use it, first there must be a Page model in the background:
Page. java:
Public class Page {/*** current Page number */private int currPageNum = 1;/*** total number of records */private int totalRowSize = 0; /*** number of records per page */private int pageRowSize = 10; public int getCurrPageNum () {return currPageNum;} public void setCurrPageNum (int currPageNum) {this. currPageNum = currPageNum;} public int getTotalPageNum () {int total = (totalRowSize % pageRowSize = 0 )? (TotalRowSize/pageRowSize) :( totalRowSize/pageRowSize + 1); return total;} public int getTotalRowSize () {return totalRowSize;} public void setTotalRowSize (int totalRowSize) {this. totalRowSize = totalRowSize;} public int getPageRowSize () {return pageRowSize;} public void setPageRowSize (int pageRowSize) {this. pageRowSize = pageRowSize;} public int getFirstResult () {if (getCurrPageNum () <= 0) return 0; return getPageRowSize () * (getCurrPageNum ()-1 );} public int getMaxResult () {return this. getFirstResult () + this. getPageRowSize ();}}
See list_user.jsp:
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %> Asynchronous Paging