skyful

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  16 Posts :: 0 Stories :: 45 Comments :: 0 Trackbacks

我的评论

re: JSP数据库数据分页显示 氓氓 2006-06-02 16:24  
public String getPageString() throws Exception
{
String PageString,hrefA,hrefB,hrefS,hrefE,tempSelect;
int Lines_1,i;
Lines_1 = TotalPageCount();
//PageName = "index.jsp";
hrefS = "<a href=" + PageName + "?thePage=1" + PassStr + "><font class=pnF>首页</font></a>";
hrefE = "<a href=" + PageName + "?thePage=" + (Lines_1) + PassStr + "><font class=pnF>未页</font></a>";
if (thePage <= 1)
{
hrefA = "<a disabled><font class=pnF>上一页</font></a>";
}
else
{
hrefA = "<a href=" + PageName + "?thePage=" + (thePage - 1) + PassStr + "><font class=pnF>上一页</font></a>";
}

if (thePage >= Lines_1)
{
hrefB = "<a disabled><font class=pnF>下一页</font></a>";
}
else
{
hrefB = "<a href=" + PageName + "?thePage=" + (thePage + 1) + PassStr + "><font class=pnF>下一页</font></a>";
}

PageString = "<style>.pnF{font-size=10pt;color=#000000;}</style>";
PageString = PageString + "<form action=" + PageName + " target=_self name=Pn>";
PageString = PageString + "<input type=hidden name=PassStr value=" + PassStr + ">";
PageString = PageString + "<Table cellspacing=0 cellpadding=0 width='" + TableWidth + "' align=center>";
PageString = PageString + "<tr><td align=right>";
PageString = PageString + hrefS + "&nbsp;&nbsp;";
PageString = PageString + hrefA + "&nbsp;&nbsp;" + hrefB + "&nbsp;&nbsp;";
PageString = PageString + hrefE + "&nbsp;&nbsp;";
PageString = PageString + "<select style=font:10pt name=thePage class=inputSelect onchange=\"javascript:window.location.href='" + PageName + "?thePage='+this.form.thePage.value+'" + PassStr + "'\">";
for (i=1; i<=Lines_1 ;i++ )
{
if (thePage == i )
{
tempSelect = "selected";
}
else
{
tempSelect = "";
}
PageString = PageString + "<option value=" + i +" "+ tempSelect + ">第" + i + "页</option>";
}

PageString = PageString + "</select>&nbsp;<font class=pnF>共<font color=red>" + Lines_1 + "</font>页&nbsp;共<font color=red>" + RsCount() + "</font>条记录</font>";
PageString = PageString + "</td></tr></Table></form>";
//System.out.println(PageString);
return PageString;

}

如上 PassStr 就是传递得参数,不知道是不是你要的