javabbs代码 javagui代码( 三 )


str.append(" ");
str.append("a href='" + url + "currentpage=" + ProPage
+ "'上一页/a");
str.append(" ");
} else {
str.append("首页");
str.append(" ");
str.append("上一页");
str.append(" ");
}
if (this.currentpagethis.pagecount) {
str.append("a href='" + url + "currentpage=" + Nextpage
+ "'下一页/a");
str.append(" ");
} else {
str.append("下一页");
str.append(" ");
}
if (this.pagecount1this.currentpage != this.pagecount) {
str.append("a href='" + url + "currentpage=" + pagecount
+ "'尾页/a");
str.append(" ");
} else {
str.append("尾页");
str.append(" ");
}
str.append("转到");
str
.append("select name='currentpage' onchange='javascript:ChangePage(this.value);'");
for (int j = 1; j = pagecount; j++) {
str.append("option value='" + j + "'");
if (currentpage == j) {
str.append("selected");
}
str.append("");
str.append("" + j + "");
str.append("/option");
}
str.append("/select页");
str.append("/tdtd width='3%' /td/tr/table");
str.append("script language='javascript'");
str.append("function ChangePage(testpage){");
str.append("document.pageform.action='" + url
+ "currentpage='+testpage+'';");
str.append("document.pageform.submit();");
str.append("}");
str.append("/script");
str.append("/form");
} else if (flag.equals(PageDAO.Image)) {
/**
* 图片的分页
*/
} else if (flag.equals(PageDAO.BbsText)) {
/**
* 论坛形式的分页[直接以数字方式体现]
*/
str
.append("table width='100%' border='0' cellspacing='0' cellpadding='0'");
str.append("tr");
str.append("td width='3%' /td");
str.append("td height='26'");
str.append("记录" + this.rscount + "条");
str.append("共" + this.pagecount + "页");
str.append("每页" + this.pagesize + "记录");
str.append("现在" + this.currentpage + "/" + this.pagecount + "页");
str.append("/tdtd");
// 设定是否有首页的链接
if (this.currentpage1) {
str.append("a href='" + url + "currentpage=1'首页/a");
str.append("");
}
// 设定是否有上一页的链接
if (this.currentpage1) {
str.append("a href='" + url + "currentpage=" + ProPage
+ "'上一页/a");
str.append("");
}
// 如果总页数只有10的话
if (this.pagecount = 10) {
for (int i = 1; i = this.pagecount; i++) {
if (this.currentpage == i) {
str.append("font color=red[" + i
+ "]/font");
} else {
str.append("a href='" + url + "currentpage=" + i
+ "'" + i + "/a");
}
}
} else {
// 说明总数有超过10页
// 制定特环的开始页和结束页
int endPage = this.currentpage + 4;
if (endPagethis.pagecount) {
endPage = this.pagecount;
}
int startPage = 0;
if (this.pagecount = 8this.currentpage = 8) {
startPage = this.currentpage - 5;
} else {
// 表示从第一页开始算
startPage = 1;
}
System.out.println(startPage);
System.out.println(endPage);
for (int i = startPage; i = endPage; i++) {
if (this.currentpage == i) {
str.append("font color=red[" + i
+ "]/font");
} else {
str.append("a href='" + url + "currentpage=" + i
+ "'" + i + "/a");
}
}
}
// 设定是否有下一页的链接
if (this.currentpagethis.pagecount) {
str.append("a href='" + url + "currentpage=" + Nextpage
+ "'下一页/a");
str.append("");
}
// 设定是否有尾页的链接
if (this.pagecount1this.currentpage != this.pagecount) {
str.append("a href='" + url + "currentpage=" + pagecount

推荐阅读