/**
* GOOGLE 分页
* @param curpage 当前页
* @param showNum 页面显示的页数
* @param pages 实际页数
* @return
*/
protected Integer[] pagesSplit(Integer curpage, Integer showNum, Integer pages ) {
Integer startIndex = curpage;
Integer endIndex = showNum;
endIndex = showNum + startIndex - 1;
if(endIndex > pages) {
endIndex = pages;
}
if(endIndex - startIndex + 1 == showNum) {
endIndex = showNum;
}
startIndex = endIndex - showNum + 1;
if(endIndex - startIndex + 1 < showNum) {
startIndex = endIndex - startIndex + 1;
}
if(startIndex <= 0) {
startIndex = 1;
}
if(endIndex <= 0) {
endIndex = 0;
}
return new Integer[]{startIndex, endIndex};
}此方法返回就是页面显示的 起始页 和 结束页。如页面输出的链接从第5页开始, showNum为10,当实际页数大于10页的时候页面就可以输出:5 6 7 8 9 10 11 12 13 14如页面输出的链接从第5页开始, showNum为10,当实际页数不够10页,实际页数为8页的时候页面就可以输出:1 2 3 4 5 6 7 8
页面输出分页链接:
<c:forEach var="current" begin="${startIndex}" end="${endIndex}">
<a href="">${current}</a>
</c:forEach>
解决方案 »
- jsp的表格数据上传 求各位前辈帮忙看看
- 关于ext grid remove的问题
- 树型结构
- 发送邮件失败javax.mail.NoSuchProviderException: smtp
- 请问大侠,使用java有没有可能在web浏览器上调用客户端USB摄像头,采集客户端视频,以让点对点,或多点对多点以web浏览器作为容器,进行视频聊天
- 新闻:::::::split::::::::设计有误!
- 请问后缀名为bak的文件是什么文件?
- js正则问题
- 怎样在sql server数据库中存取Blob字段?
- servlet 类文件放哪里?
- 安装版的Tomcat 手动 启动问题 帮帮忙啊
- ubuntu 下安装mysql 。。。
我这儿有个分页插件:
http://download.csdn.net/source/2452703
,希望能帮助你!