您的位置:首页 > Web前端 > JavaScript

一种新的编程思路(下):附 自动分页2-1 ntPage.jsp

2002-07-15 10:06 615 查看
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 ;
}
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: