图片显示的
10
就是
后面
int num=6;
定义所说的页码数
Private int
nowpage
;
//
当前页
Private int
countrecord
;
//
总记录数
Private int
countpage
;
//
总页数
Private int
pageindex
;
//
当前页记录开始的位置
(nowpage-1)*PAGESIZE
Publics static final int
PAGESIZE
= 5;
//
每页显示的记录数
Private int
sumindex
= 6;
//
索引的
sum
值代表的是
google
页面中最大显示页数
Private int
startindex
;
//
开始的索引值
Private int
endindex
;
//
结束的索引值
//
计算索引位置
StudentServiceImpl ssi =
new
StudentServiceImpl();
int
lastpage = ssi.getCountPage();
//
获得总页数
int
startindex = 1;
//
开始索引
int
endindex = (3 + nowpage - 1)>lastpage?lastpage:(3 + nowpage - 1);
//
结束索引
int
num = 6;
//
显示的页码数
if
(endindex>=num){
//
判断
最后索引值
是否大于
显示的页码数
if
(endindex>=lastpage){
//
判断
最后索引值
是否大于
最后总页数
endindex=lastpage;
}
if
(lastpage>num){
//
判断
总页数
是否小于
显示的页码数
startindex=endindex-num+1;
}
}
System.
out
.println(
"endindex
:
"
+ endindex +
",lastpage:"
+ lastpage+
",startindex:"
+startindex);
this
.
startindex
=startindex;
this
.
endindex
=endindex;
this
.
nowpage
=nowpage;
this
.
lastpage
=lastpage;
this
.
num
=num;
this
.
li
=ssi.getNowPageInfo(nowpage);