JSP写的用户管理的脚本

用户管理的主页

<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>&nbsp;</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%>&nbsp;&nbsp;&nbsp;共<%=intPageCount%>&nbsp;&nbsp;&nbsp;

<%if(intPage<intPageCount)...{%>

<ahref="yj_usergl.jsp?page=<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值