这两个页面都涉及到了JavaBean的具体调用,还是来看看文件吧,对于文件中关键代码,都会添加上注释,以方便大家理解......
作者:刘玉峰 来源:yesky 2007年10月31日
关键字:
//获取记录总数
strSQL = "select count(*) from user";
ResultSet result = db.executeQuery(strSQL); //执行SQL语句并取得结果集
result.next(); //记录集刚打开的时候,指针位于第一条记录之前
intRowCount = result.getInt(1);
result.close(); //关闭结果集
//记算总页数
intPageCount = (intRowCount+intPageSize-1) / intPageSize;
//调整待显示的页码
if(intPage$#@62;intPageCount) intPage = intPageCount;
strSQL="select * from user order by id desc";
//执行SQL语句并取得结果集
result = db.executeQuery(strSQL);
//将记录指针定位到待显示页的第一条记录上
i = (intPage-1) * intPageSize;
for(j=0;j$#@60;i;j++) result.next();
%$#@62;
$#@60;html$#@62;
$#@60;head$#@62;
$#@60;meta http-equiv="Content-Language" content="zh-cn"$#@62;
$#@60;meta http-equiv="Content-Type" content="text/html; charset=gb2312"$#@62;
$#@60;meta name="GENERATOR" content="Microsoft FrontPage 3.0"$#@62;
$#@60;meta name="ProgId" content="FrontPage.Editor.Document"$#@62;
$#@60;title$#@62;用户列表$#@60;/title$#@62;
$#@60;/head$#@62;
$#@60;body bgcolor="#FFEBBD"$#@62;
$#@60;div align="center"$#@62;$#@60;center$#@62;
$#@60;table border="1"
borderColorDark="#FFFFFF" borderColorLight="#000000" cellspacing="0" height="22"
width="100%"$#@62;
$#@60;tr bgcolor="#FFEBAD"$#@62;
$#@60;td height="1" width="691" class="main"$#@62;
第$#@60;%=intPage%$#@62;页 共$#@60;%=intPageCount%$#@62;页
$#@60;a href="listuser.jsp?page=0"$#@62;首页$#@60;/a$#@62;
$#@60;%if(intPage$#@62;1){%$#@62;$#@60;a href="listuser.jsp?page=$#@60;%=intPage-1%$#@62;"$#@62;上一页$#@60;/a$#@62;$#@60;%}%$#@62;
$#@60;%if(intPage$#@60;=1){%$#@62;上一页$#@60;%}%$#@62;
$#@60;%if(intPage$#@60;intPageCount){%$#@62;$#@60;a href="listuser.jsp?page=$#@60;%=intPage+1%$#@62;"$#@62;下一页$#@60;/a$#@62;$#@60;%}%$#@62;
$#@60;%if(intPage$#@62;=intPageCount){%$#@62;下一页$#@60;%}%$#@62;
$#@60;a href="listuser.jsp?page=$#@60;%=intPageCount%$#@62;"$#@62;尾页$#@60;/a$#@62;
第$#@60;input type="text" class="main" name="page" size="3" value="$#@60;%=intPage%$#@62;" tabindex="1"$#@62;页$#@60;input type="submit" class="main" value="go" name="B1" tabindex="2"$#@62;$#@60;class="main"$#@62;
$#@60;/td$#@62;$#@60;/tr$#@62;$#@60;/table$#@62;$#@60;/form$#@62;