📄 da_book.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查看和修改</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style></head>
<%@ include file="../inc/conn.jsp"%>
<link href="../style1.css" rel="stylesheet" type="text/css" />
<body>
<%
//删除操作
if(request.getParameter("delid")!=null)
{
sql="delete from tushumingxi where shuID="+request.getParameter("delid");
//out.print(sql);
stmt.executeUpdate(sql);
out.print("<script>alert('图书删除成功!');window.location='da_book.jsp';</script>");
}
%>
<%
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount; //总页数
int intPage; //待显示页码
String strPage,lei;
int i;
// 设置一页显示的记录数
intPageSize =3;
//取得待显示页码
strPage = request.getParameter("page");
lei = request.getParameter("Cateid"); //图书类别
String Cateid=lei;
if(lei==null){lei="1";}
//while(rs.next()){
if(strPage==null){
//表明在QueryString中没有page这一个参数,此时显示第一页数据
intPage = 1;
} else{
//将字符串转换成整型
intPage = java.lang.Integer.parseInt(strPage);
}if(intPage< 1){
intPage = 1;
}
dbBean.connection();
Statement selstmt =dbBean.con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
//sql="select * from tushumingxi where lieID="+Cateid;
sql="select * from tushumingxi";
// String sort=request.getParameter("sort");
// if(sort!=null){
// sql="select * from tushumingxi where lieID="+Cateid+" order by "+request.getParameter("sort")+" desc";
// sql="select * from tushumingxi where lieID="+Cateid;
// out.print("select * from tushumingxi where lieID="+Cateid+" order by "+request.getParameter("sort")+" desc");
// sql="select * from tushumingxi where [lieID]=["+Cateid+"] order by ["+sort+"] desc";
// }
rs=selstmt.executeQuery(sql);
//获取记录总数
rs.last();
intRowCount = rs.getRow();
//记算总页数
intPageCount = (intRowCount+intPageSize-1)/intPageSize;
//调整待显示的页码
if(intPage>intPageCount) intPage = intPageCount;
if(intPageCount>0){
//将记录指针定位到待显示页的第一条记录上
rs.absolute((intPage-1) * intPageSize+1);
//显示数据
}
i = 0;
//rs.next();
//while(i<intPageSize && !rs.isAfterLast()){
%>
<table width="97%" border="0" cellspacing="0" cellpadding="0" align="center" ID="Table11">
<tr>
<td class="s" align="center" height="28" valign="bottom" width="200"><font color="#000099"> 搜索结果共:[<font color="#000099"> <%=intRowCount%></font> ]条</font></td>
<td width="546" height="28" align="right" class="s">
<table border="0" class="s" ID="Table12">
<form action="" method="post" ID="Form1">
<tr>
<td> <a href="da_book.jsp?Cateid=<%=Cateid%>"><font color="#003399">首页</font></a>
<%if(intPage>1){%><a href="da_book.jsp?Cateid=<%=Cateid%>&page=<%=intPage-1%>">
<font color="#003399">上一页</font></a><%}%>
<%if(intPage<intPageCount){%><a href="da_book.jsp?Cateid=<%=Cateid%>&page=<%=intPage+1%>">
<font color="#003399">下一页 </font></a><%}%>
<a href="da_book.jsp?Cateid=<%=Cateid%>&page=<%=intPageCount%>"><font color="#003399">尾页</font></a><font color="#003399"> 页次:<font color="red"><%=intPage%>/<%=intPageCount%></font>页 每页<font color="#FF0000"><%=intPageSize%></font>条
跳转页</font>
<input name="page" size="4" style="BACKGROUND-COLOR: #f9fcff; BORDER-BOTTOM: #5f98e7 1px solid; BORDER-LEFT: #5f98e7 1px solid; BORDER-RIGHT: #5f98e7 1px solid; BORDER-TOP: #5f98e7 1px solid; FONT-SIZE: 9pt"
onMouseOver="this.focus()" onFocus="this.select()" maxlength="10" ID="Text1">
<input type="submit" name="submit" value="GO" ID="Submit1"> </td>
</tr>
</form>
</table> </td>
</tr>
</table>
<%
while(i<intPageSize && !rs.isAfterLast()){
String categoryid=rs.getString("shuID");
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"
ID="Table21">
<tr>
<td>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" ID="Table22">
<tr>
<td colspan="2"><hr size="1" noshade="NOSHADE" color="#525D76"/> </td>
</tr>
<tr>
<td width="16%" height="148"><div align="center"><a href="../Book_info.jsp?Bookid=<%=categoryid%>"><img src="../<%=rs.getString("fengmian")%>" width="100" height="140" border="0"></a></div> </td>
<td width="84%"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" ID="Table23">
<tr>
<td height="28" colspan="3"><strong><font color="#000099"><span class="m"><a href="../Book_info.jsp?Bookid=<%=categoryid%>"><font color="#0000A0">《<%=rs.getString("shu_name")%>》</font></a></span></font></strong>
<%if(rs.getString("commend").equals("1")){%>[ <font color="#FF0000">推荐</font> ] <%}%> </td>
</tr>
<tr>
<td height="25" colspan="3">出版社:<%=rs.getString("banshe")%></td>
</tr>
<tr>
<td height="25" colspan="3">作者:<span class="s"><%=rs.getString("zhuozhe")%> 等</span></td>
</tr>
<tr>
<td height="20">上架日期:<%=rs.getString("date")%> <span class="s">浏览次数:170次</span>
</td>
</tr>
<tr>
<td height="30"><table width="90%" border="0" cellspacing="0" cellpadding="0" align="left" ID="Table24">
<tr>
<td align="left"><strong>定价:</strong><strike><font color="#999999">¥<%=rs.getString("dingjia")%></font></strike>
<font color="#000099"><strong>会员:</strong></font><font color="#FF0000">¥<%=rs.getString("huiyuanjia")%></font> <a href="da_book.jsp?delid=<%=categoryid%>"><font color="#FF0000">[ 删 除 ]</font></a></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="3">
<a href="ShopCar_info.jsp?addBookid=<%=categoryid%>"><img src="../pic/shopcart.gif" alt="放入购物车" width="90" height="16" border="0"></a>
<span class="s">
<a href="javascript:AddToMyBook('mybookproc.asp?lbbh=10008936')"><img src="../pic/per.gif" alt="加入个人收藏" width="16" height="18" border="0">
加入收藏</a></span> </td>
</tr>
</table> </td>
</tr>
</table>
<br>
<table width="97%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#999999"
ID="Table25">
<tr>
<td height="7" bordercolor="#FFFFFF"></td>
</tr>
<tr>
<td height="20" bordercolor="#FFFFFF"><table width="97%" border="0" align="center" cellpadding="0" cellspacing="0" ID="Table26">
<tr>
<td> <font color="#990000"><%=rs.getString("shu_jian")%>...</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="7" bordercolor="#FFFFFF"></td>
</tr>
</table>
<br>
</td>
</tr>
</table>
<%i++;
rs.next();
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -