📄 adminedit1.jsp
字号:
<%@ include file="conn.jsp"%>
<%String classtype=request.getParameter("classtype");
String classid=request.getParameter("classid");
String selAnnounce=request.getParameter("selAnnounce");
String action1=request.getParameter("action");
String sqlname;
if(action1.equals("del")){
stmt.executeUpdate("delete from scott.article where articleid in (" + selAnnounce + ")");
out.print("<script>alert('删除成功');history.back();</script>");
}%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="98%" class="border">
<tr>
<td width="100%" align=center class="title"> <a href="adminedit.jsp">返回管理页面</a> |
<a href="freeadd.jsp?classid=<%=classid%>&classtype=<%=classtype%>">添加内容</a></td>
</tr>
</table>
<br>
</center>
<table class="border" border="0" cellspacing="0" width="95%" cellpadding="3" align="center">
<form method=Post action="adminedit1.jsp?action=del">
<input type="hidden" name="classid" value=2>
<input type="hidden" name="classtype" value=1>
<tr class="title">
<td width="46" align="center" height="20"><strong>ID</strong></td>
<td width="400" align="center" ><strong>资 料</strong></td>
<td width="68" align="center" >
<input type='submit' value='删 除' class="but">
</td>
</tr>
<%
int intPageSize;
int intRowCount;//记录总数
int intPageCount;//总页数
int intPage;//页面参数
String strPage;//定义变量用来传递page
int i,j;
intPageSize=20;//定义每页显示20条记录
strPage=request.getParameter("page");//取得当前的页码
if(strPage==null){//判断初始页面,如果没有显示记录,就置为第一页
intPage=1;
}else{
intPage=Integer.parseInt(strPage);//将strPage转化为整数
if(intPage<1) intPage=1;
}
sqlname="select count(articleid) from scott.article where classid='"+classid+"' order by addtime desc";
ResultSet rst=stmt.executeQuery(sqlname);
rst.next();
intRowCount=rst.getInt(1);//取得整数保存与intRowCount变量中
intPageCount=(intRowCount+intPageSize-1)/intPageSize;//计算出总页数(记录总数+每页显示的记录-1)/每页显示的记录)
if(intPage>intPageCount)
intPage=intPageCount;
sqlname="select articleid,title,addtime,classid from scott.article where classid='"+classid+"' order by articleid desc";
rst=stmt.executeQuery(sqlname);//执行sql,按照时间先后排序显示
i=(intPage-1)*intPageSize;
for(j=0;j<i;j++)
rst.next();
%>
<%-- 设置intPage参数 --%>
<%if(intRowCount==0){%>
对不起,还没有数据!
<%}else{%>
<%-- 显示每页的数据 (根据i的值判断每页的5条记录) --%>
<%
i=0;
while(i<intPageSize && rst.next()){
%>
<tr class="tdbg2">
<td height="20" width="46">
<p align="center"><%=rst.getString("articleid")%>
</td>
<td width="400"><a href="editarticle.jsp?id=<%=rst.getString("articleid")%>&classid=<%=rst.getString("classid")%>&classtype=<%=classtype%>"><%=rst.getString("title")%></a>
</td>
<td width="68">
<p align="center">
<input type='checkbox' name='selAnnounce' value='<%=rst.getString("articleid")%>'>
</td>
</tr>
<% i++;//通过I循环设置每页的页数
}
}
rst.close();
%>
<tr class="tdbg">
<td colspan="3" >
<div align="center">
<p align='center' vAlign='bottom' >
</div>
</td>
</tr>
</form>
</table>
<p align='center'> 第<%=intPage%>页 共<%=intPageCount%>页
<%if(intPage<intPageCount){%>
<a href="adminedit1.jsp?action=edit&classid=<%=classid%>&page=<%=intPage+1%>&classtype=<%=classtype%>" class="list3">下一页</a>
<%}%>
<%if(intPage>1){%>
<a href="adminedit1.jsp?action=edit&classid=<%=classid%>&page=<%=intPage-1%>&classtype=<%=classtype%>" class="list3">上一页</a>
<%}%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -