i***c 发帖数: 301 | 1 跪求分页实现,如何把太多的页码也分为如此格式:previous|1|2|...|10|next?
long cPage;
cPage = (hits.getTotal() / 10) + 1;
if ((cPage * 10) + 1 >= hits.getTotal())
{
cPage++;
}
if(cPage>100)
{cPage=100;}
int p;
for(p = 1; p < cPage ; p++)
{
out.println("
queryLang + " &start="+ (p-1) * 10 + " &hitsPerPage=" + hitsPerPage + " &
hitsPerSite=" + 0 + "&clustering=>"+ p +" | ");
}
给包子50 |
g*****g 发帖数: 34805 | 2 jsp不是干这个的,还是先学会用web framework,把逻辑放入
servlet里先。
【在 i***c 的大作中提到】 : 跪求分页实现,如何把太多的页码也分为如此格式:previous|1|2|...|10|next? : long cPage; : cPage = (hits.getTotal() / 10) + 1; : if ((cPage * 10) + 1 >= hits.getTotal()) : { : cPage++; : } : if(cPage>100) : {cPage=100;} : int p;
|
i***c 发帖数: 301 | |
i***c 发帖数: 301 | |
i***c 发帖数: 301 | 5 sorry,应该没有if这两行的,现在到这一步,要到google的分页一样
long cPage;
cPage = (hits.getTotal() / 10) + 1;
if ((cPage * 10) + 1 >= hits.getTotal())
{
cPage++;
}
int p;
for(p = 1; p < cPage ; p++)
{
out.println("
queryLang + " &start="+ (p-1) * 10 + " &hitsPerPage=" + hitsPerPage + " &
hitsPerSite=" + 0 + "&clustering=>"+ p +" | ");
} |
m******t 发帖数: 2416 | 6 If you have to use jsp only (which isn't a good idea as goodbug pointed out)
, checkout the pagination support in displaytags. |