pager-taglib 中 页码的算法

int totalCount =  记录总数;

int itemCountForPage =  每页记录数;

那么

int pageCount= totalCount / itemCountForPage + (totalCount % itemCountForPage == 0 ? 0 : 1); // 页数

int offset =  (pageCount- 1) * itemCountForPage ;  //在URL里作为参数pager.offset的值

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.