Jsp (preferred for SUN Enterprise applications)Data Paging
Author:He shuangjiang
Keywords: Java jsp (preferred for SUN Enterprise applications)Data PagingYarshrayHe shuangjiang
AboutWebData paging in applications seems to be a common topic,Although many people have written similar articles,However, I still want to express my point of view in words.,Although there is nothing new,But I will always give you some help..
First.For data Paging,In my understanding, the number of records on the current page and the number of records on each page are given.,And must know the total number of records.,Total number of pages,And the range of the currently displayed records.Based on the above analysis, I will know,Questions:
Known Conditions:Current page numberNumber of records per pageTotal number of records
1Calculate the total number of pages:
Total number of pages=Total number of records/Number of records per page;
IFTotal number of recordsModNumber of records per page//For Remainder,That is, when division is not allowed
Begin
Total number of pages=Total number of pages+ 1;
End
`2Returns the range of the current record.
Current first record=Current page number/Total number of pages