用户管理的主页
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<metaname="GENERATOR"content="MicrosoftFrontPage4.0">
<metaname="ProgId"content="FrontPage.Editor.Document">
<title>用户管理</title>
<linkrel=stylesheethref="style.css"type="text/css">
<styletype="text/css">
<!--

.style2...{
font-size:11pt;
color:#FF3300;
}
-->
</style>
</head>
<body>
<divalign="center">
<center>
<tableborder="0"width="500"cellspacing="0"cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<tdwidth="100%">
<%Stringsqlname;
intintPageSize;
intintRowCount;//记录总数
intintPageCount;//总页数
intintPage;//页面参数
StringstrPage;//定义变量用来传递page
inti,j;
intPageSize=10;//定义每页显示10条记录
strPage=request.getParameter("page");//取得当前的页码



if(strPage==null)...{//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;

}else...{
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1)intPage=1;
}


sqlname="selectcount(*)fromusersorderbyiddesc";
ResultSetrt=stmt.executeQuery(sqlname);
rt.next();


intRowCount=rt.getInt(1);//取得整数保存与intRowCount变量中
intPageCount=(intRowCount+intPageSize-1)/intPageSize;//计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)


if(intPage>intPageCount)
intPage=intPageCount;


sqlname="select*fromusersorderbyiddesc";
ResultSetrs=stmt.executeQuery(sqlname);//执行sql,按照时间先后排序显示


i=(intPage-1)*intPageSize;
for(j=0;j<i;j++)
rs.next();%>


<%--设置intPage参数--%>


<divalign="center">
<center>
<tablewidth="530"border="0"cellpadding="0"cellspacing="1"bordercolor="#FFFFFF"bordercolorlight="#000000"bordercolordark="#FFFFFF">
<tr>
<tdbgcolor="#000000">
<tablewidth="100%"border="0"cellpadding="5"cellspacing="1"bgcolor="#000000">
<trbgcolor="#00CCCC">
<tdheight="24"width="55"align="center">
<fontcolor="#000000">用户编号</font></td>
<tdwidth="65"align="center"><fontcolor="#000000">用户姓名</font></td>
<tdwidth="120"align="center"><fontcolor="#000000">电话</font></td>
<tdwidth="190"align="center"><fontcolor="#000000">地址</font></td>
<tdwidth="100"align="center"><fontcolor="#000000">操作</font></td>
</tr>



<%if(intRowCount==0)...{%>



<%}else...{%>


<%--显示每页的数据(根据i的值判断每页的10条记录)--%>


<%
i=0;

while(i<intPageSize&&rs.next())...{
%>
<trbgcolor="#A2DFEA">
<tdheight="24"align="center"><fontcolor="#000000"><%=rs.getInt("id")%></font></td>
<tdalign="center"><fontcolor="#000000"><%=rs.getString("user_name")%></font></td>
<tdalign="center"><fontcolor="#000000"><%=rs.getString("user_phone")%></font></td>
<tdalign="center"><fontcolor="#000000"><%=rs.getString("user_caddr")%></font></td>
<tdalign="center"><fontcolor="#000000">
<ahref='useradd.jsp'>添加</a>
<ahref="usermodify.jsp?userid=<%=rs.getInt("id")%>">修改</a>
<ahref='javascript:if(confirm("真的要删除这用户吗?"))window.location="userdel.jsp?userid=<%=rs.getInt("id")%>";'>删除</a>
</font></td>
</tr>
<%i++;//通过I循环设置每页的页数
}
}


rs.close();
stmt.close();
conn.close();
%>
</table>
</td>
</tr>
</table>
</div>
</table>
</div>
<tablewidth="530"border="0"align="center"bgcolor="#CCCCCC">
<tr>
<tdheight="17"valign="middle"bgcolor="#0099CC">


<FORMaction=new.jspmethod=POST>
<palign='center'vAlign='bottom'>第<%=intPage%>页 共<%=intPageCount%>页 

<%if(intPage<intPageCount)...{%>
<ahref="yj_usergl.jsp?page=<
用户管理分页展示
1426

被折叠的 条评论
为什么被折叠?



