jsp 分页 怎样设定显示的页码数

2024-12-31 19:46:38
推荐回答(1个)
回答1:

for (int i = 1; i <= (pageCount<10?pageCount:10); i++) {
out.println("[" + i + "]");}

如果每次点击有取页码参数.比如pageNow.
for (int i = pageNow; i <= (pageCount<(pageNow+9)?pageCount:(pageNow+9)); i++) {
out.println("[" + i + "]");}