public static final String splitPages2(int thePage, String queryString, int count,
int pageLength)
{
int maxPage = count / pageLength + 1;
int prevPage = thePage - 1;
if (prevPage < 1)
{
prevPage = 1;
}
int nextPage = thePage + 1;
int showMaxPage = thePage + 6;
int spacePage = 1;
if (thePage > 6)
{
spacePage = thePage - 5;
}
if (showMaxPage < 10)
{
showMaxPage = 10;
}
//<p class="fy"><a class="back" href="">上一页</a><a href="">01</a><a href="">02</a><a href="">03</a><a class="next" href="">下一页</a></p>
StringBuffer sb = new StringBuffer();
sb.append("<p class=\"fy\"> <a href=\""+queryString+"\">第一页</a>");
sb.append("<a class=\"back\" href=\"" + queryString + "&pagex=" + prevPage
+ "\">上一页</a>");
for (int i = spacePage; i < showMaxPage && i <= maxPage; i++)
{
String fontColor = "black";
if (i == thePage)
{
fontColor = "red";
}
sb.append("<a href=\"" + queryString + "&pagex=" + i
+ "\"><font color=" + fontColor + ">" + addzero(i, 2)
+ "</font></a>");
}
[1] [2] 下一页