📄 delete_shop.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.io.*,java.sql.*" errorPage="errorpage.jsp"%>
<html>
<head>
<title>删除商铺信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body text="#FFFFFF" link="#66FF00" >
<br>
<br>
<p>
<div align="center"><font color="#3366FF" size="4">商铺信息列表</font></div>
</p>
<br>
<table border="1" cellspacing="1" cellpadding="1" align="center" >
<tr>
<td align=center><font color="#0033CC">编号</font></td>
<td align=center><font color="#0033CC">类型</font></td>
<td align=center><font color="#0033CC">面积</font></td>
<td align=center><font color="#0033CC">等级</font></td>
<td align=center><font color="#0033CC">价格</font></td>
<td align=center><font color="#0033CC">删除</font></td>
</tr>
<%
Connection con=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//userManage是odbc数据源的名称
con=DriverManager.getConnection("jdbc:odbc:zn","","");
Statement stmt=con.createStatement();
//定义每页的纪录行数(pageLine)、当前页(intPage,初始值为1)、总纪录数(totalRec)、总页数(intPageCount)
//String page = request.getParameter("page");
//String page = request.getParameter("page");
String str_page = request.getParameter("page");
if(str_page==null)
str_page = "1";//初始化;
int intPage = Integer.parseInt(str_page);//字符转为int;
if(intPage<1) intPage=1;
int thisPage = intPage;//记录为第几页.
int totalRec= 0;
int intPageCount=0;
int pageLine= 20;//设定每页20行
//取得总纪录数代码如下:
String sql1="select count(*)as cnt from shop";
ResultSet rs_totalRec=stmt.executeQuery(sql1);//
if(rs_totalRec.next())
totalRec=rs_totalRec.getInt("cnt");
rs_totalRec.close();
// 取得总页数代码如下:
intPageCount=(totalRec+pageLine-1)/pageLine;
//user是数据库中的表名
ResultSet rs=stmt.executeQuery("select * from shop");
if(intPageCount>0)//如果总页数大于0,则执行下面语句
{
for(int m=1;m<=(thisPage-1)*pageLine;m++)
//页循环
rs.next();//分页定位,确定开始显示的数据位置。
for(int i=1;i<=pageLine;i++){
if(rs.next()){
String a=rs.getString("id");
%>
<tr><td align=center><font color="#3366FF"><%=rs.getString("bm")%></font></td>
<td align=center><font color="#3366FF"><%=rs.getString("style")%></font></td>
<td align=center><font color="#3366FF"><%=rs.getString("mj")%></font></td>
<td align=center><font color="#3366FF"><%=rs.getString("grade")%></font></td>
<td align=center><font color="#3366FF"><%=rs.getString("price")%></font></td>
<td align=center><a href="delete_shopsave.jsp?id=<%=a%>"><font color="#3366FF">删除</font></a></td>
</tr>
<%
}// if(rs.next())-end
}// for(int i=1;i<=pageLine;i++)-end
}//if(intPageCount>0)-end
else
{out.println("<tr>数据库为空</tr>");
}
%>
<tr>
<td><font color="#3366FF">第 <%=intPage%>页/共 <%=intPageCount%> 页</font></td>
<%
if(intPage <2) {
%>
<td><font color="#3366FF">【首页】</font></td>
<td><font color="#3366FF">【上一页】</font></td>
<%
}else {
%>
<td><a href="ilist.jsp?page=1">【首页】</a></td>
<td><a href="ilist.jsp?page=<%=thisPage-1%>">【上一页】</a></td>
<%
}//if--else--end
if(intPage - intPageCount >=0)//如果当前页数小于等于总页数,下一页和尾页出现链接
{
%>
<td><font color="#3366FF">【下一页】</font></td>
<td><font color="#3366FF">【尾页】</font></td>
<%
}else{
%>
<td><a href="ilist.jsp?page=<%=thisPage+1%>">【下一页】</a></td>
<td><a href="ilist.jsp?page=<%=intPageCount%>">【尾页】</a></td>
<%
}//if--else--end
%>
<%
rs.close();
stmt.close();
con.close();
}//try-end
catch(Exception e){
out.println(e.getMessage());
}//catch
%>
</table>
<br>
<div align="center"><a href="add_shop.jsp"><font color="#3366FF">添加商铺信息</font></a>办法<font color="#0099FF"><a href="manager.jsp">>>返回后台管理</a></font></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -