求 jsp 购物网站 代码
看懂这个,就OK了,实现会员管理界面(会员查询,删除)<br>呵呵,注意下面两点,我标志的<br><br><%@ page contentType="text/html; charset=UTF-8" language="java" %><br><%@ page import="java.sql.*"%><br><%@ page import="Bean.QueryBean"%><br><jsp:useBean id="query" scope="page" class="Bean.QueryBean"/><br><html><br><head><br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><br><title><br>admincontrol<br></title><br></head><br><%!<br>ResultSet rs=null;<br>String sql,login;<br>int code;<br>int pagesize=3;<br>int rowcount=0;<br>int pagecount=1,n;<br>int showpage=1;<br>%><br><script language="javascript"> <br> function check_delete() <br> {if (confirm("你确定它删除吗?")) <br> return true; <br> else <br> return false;} <br></script> <br><br><body bgcolor="#ffffff"><br><a href="index.jsp">返回首页<a><br><table border="1" width="786" align="center"bordercolor="#FFFFFF" cellpadding="0" cellspacing="0"bordercolordark="#333333" bordercolorlight="#FFFFFF"><br> <tr><br> <td width="786" align="center" colspan="6" height="32">用户管理</td><br> </tr><br> <form name="form1" method="post" action=""><br> <tr><br> <td width="18%" align="center"height="27">用户ID</td><br> <td width="17%" align="center"height="27">用户名</td><br> <td width="17%" align="center"height="27">用户身份</td><br> <td width="17%" align="center"height="27">注册时间</td><br> <td width="17%" align="center"height="27">管理</td><br> </tr><br><%<br> sql="select * from userinfo order by addtime desc";//会员查询<br>try<br>{<br> rs=query.executeQuery(sql);<br>if(!rs.next())<br>{<br>%><br><script language="javascript"><br> alert("没有用户信息");<br></script><br><%<br>}else<br>{<br>rs.last();<br>rowcount=rs.getRow();<br>pagecount=((rowcount%pagesize)==0?(rowcount/pagesize):(rowcount/pagesize)+1);<br> String topage=request.getParameter("topage");<br>if(topage!=null)<br>{<br>showpage=Integer.parseInt(topage);<br>if(showpage>pagecount){<br> showpage=pagecount;<br> }else if(showpage<=0){<br> showpage=1;<br> }<br>}<br>rs.absolute((showpage-1)*pagesize+1);<br>for(int i=1;i<=pagesize;i++)<br>{<br>code=rs.getInt("id");<br>%><br> <tr><br> <td width="17%" align="center" height="27"><%=code%></td><br> <td width="17%" align="center"height="27"><%=rs.getString("username")%></td><br> <td width="17%" align="center"height="27"><%=rs.getString("logrole")%></td><br> <td width="18%" align="center"height="27"><%=rs.getString("addtime")%></td><br> <td width="17%" align="center"height="27"><a href="Userdel?id=<%=code%>" onclick="return check_delete();">删除</a> </td><br> </tr>//删除功能<br><%<br>if(!rs.next())<br>break;<br>}}<br>}catch(Exception e)<br>{out.println("查询异常!!!");}<br>%><br><tr><br> <td width="786" height="30" colspan="9" align="right"><br><table width="786" align="center" cellpadding="0" cellspacing="0"><br> <tr><br> <td width="786" height="30" colspan="6" align="right"><br> <div align="center">共<%=pagecount%>页 <br> <a href="admincontrol.jsp?topage=<%=1%>">第一页</a> <br> <a href="admincontrol.jsp?topage=<%=showpage-1%>">上一页</a> <br> <a href="admincontrol.jsp?topage=<%=showpage+1%>">下一页</a> <br> <a href="admincontrol.jsp?topage=<%=pagecount%>">最后一页</a> <br> </div><br> </td><br> </tr><br></table><br> </td><br></tr><br></form><br></table><br></body><br></html>