ntPage.JSP
-------------------------------------------------------------------
int PAGESIZE = 10;
int old_PAGESIZE = PAGESIZE ;
int curPage = 1;
int pageCount=0;
int iStart=0;
int iCount=0;
int totalRecordCount = ntP.rowCount ;
boolean onlyOnePage = true ;
try {
if( request.getParameter("pagesize")!=null )
PAGESIZE = Integer.parseInt(request.getParameter("pagesize"));
if( request.getParameter("pagesize_post")!=null )
PAGESIZE = Integer.parseInt(request.getParameter("pagesize_post"));
}catch(Exception ePage13){
PAGESIZE = old_PAGESIZE ;
}
if( PAGESIZE < totalRecordCount )
onlyOnePage = false ;
try {
curPage = Integer.parseInt(request.getParameter("page"));
}catch(Exception e){
curPage = 1;
}
if ( totalRecordCount > 0)
{
pageCount = totalRecordCount / PAGESIZE;
if ( totalRecordCount % PAGESIZE != 0)
pageCount += 1;
if (curPage < 1)
curPage = 1;
if (curPage > pageCount)
curPage = pageCount;
iStart = (curPage-1) * PAGESIZE;
iCount = totalRecordCount - iStart;
if (iCount > PAGESIZE)
iCount = PAGESIZE;
iCount = iStart + iCount ;
}
%>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-991644/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10752043/viewspace-991644/
本文详细介绍了自动分页技术的实现方法,通过设置每页显示的记录数、当前页数等参数,实现了对大量数据的有效分页展示。该技术能够根据用户请求动态调整分页大小,并确保数据正确显示。
2257

被折叠的 条评论
为什么被折叠?



