一种新的编程思路(下):附 自动分页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 ;
}
%>
-------------------------------------------------------------------
<%
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 ;
}
%>
相关文章推荐
- 推荐用 Flash做一般文字为主的页面
- [教程]JScript中的变量引用规则(补充,函数用法说明)
- [教程]JScript中的变量引用规则(一)
- 汉字转化为拼音(jsp版)
- Lostinet作品:JScriptSoapClientv0.20Beta简单地异步调用你的WebService
- 如何在javascript中传值
- Lostinet作品:JScriptSoapClientv0.10Beta为你轻松调用WebService
- 简单的脚本帮你编排JScript程序中的缩进
- 得到 words.js?hello,world! 参数的处理方法
- 玩透弹出窗口
- 在WEB项目中多维下拉菜单的实现技巧和方法
- 用JScript实现VB.Net,C#的[委托Delegate]:
- 自己做二级域名的DNS
- 利用JScript/CSS 编程技术模拟实现TABView控件
- 在Web界面下数形目录显示程序(版本1.0)
- 利用JavaScript和正则表达式进行丰富的日期判断(给其它项目组的代码,有比较好的编程风格和注释)
- perl文件上传程序,支持多文件!
- javascript/Jscript实现父子窗体的互相引用问题(Powered By ZosaTapo)
- 对JSP Model 2工作流程的一些体会
- 一个javascript脚本写的俄罗斯方块