📄 da_comment.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 comment where comment_id="+request.getParameter("delid");
//out.print(sql);
stmt.executeUpdate(sql);
out.print("<script>alert('评论删除成功!');window.location='da_order.jsp';</script>");
}
%>
<%
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount; //总页数
int intPage; //待显示页码
String strPage,lei;
int i;
// 设置一页显示的记录数
intPageSize =10;
//取得待显示页码
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 comment";
// 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_comment.jsp?Cateid=<%=Cateid%>"><font color="#003399">首页</font></a>
<%if(intPage>1){%><a href="da_comment.jsp?Cateid=<%=Cateid%>&page=<%=intPage-1%>">
<font color="#003399">上一页</font></a>
<%}%>
<%if(intPage<intPageCount){%><a href="da_comment.jsp?Cateid=<%=Cateid%>&page=<%=intPage+1%>">
<font color="#003399">下一页 </font></a>
<%}%>
<a href="da_comment.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("comment_id");
%>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #B7B7B7;">
<tr>
<td width="80%" height="1" bgcolor="#FF00FF"></td>
</tr>
<tr>
<td height="25" bgcolor="#E7E7E2"><span class="bt"> [用户]:<%=rs.getString("user")%></span></td>
<td height="25" bgcolor="#E7E7E2">
<a href="da_comment.jsp?delid=<%=categoryid%>"><font color="#FF0000">[ 删 除 ]</font></a>
</td>
</tr>
<tr>
<td colspan="2"> [内容]:
<%=rs.getString("atext")%> </td>
</tr>
</table>
<%i++;
rs.next();
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -