📄 managerarticle.jsp
字号:
<%@page contentType="text/html"%>
<%@page pageEncoding="utf-8"%>
<%@page import="java.sql.*"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<%
// 没没械录转录
String role = request.getParameter("role");
if (!"user".equals(role) && !"manager".equals(role)) {
response.sendRedirect("index.jsp");
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="db" class="ArticleSharing.DBTools" scope="session"/>
<html>
<head>
<style>a{TEXT-DECORATION:none}</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>帖子管理</title>
<style type="text/css">
<!--
body {
background-image: url(picture.jpg);
}
.STYLE1 {font-size: 36px}
-->
</style></head>
<body>
<table width="764" border="0" align="center">
<tr>
<td><img src="5clogo.jpg" width="754" height="121"></td>
</tr>
</table>
<p> </p>
<table width="200" border="0" align="center">
<tr>
<td align="left">
<a href="articlelist.jsp"><img border="0" src="tubiao6.jpg" width="52" height="52"></a>
<a href="newArticle.jsp"><img border="0" src="tubiao2.jpg" width="52" height="52"></a>
</td>
</tr>
<tr>
<td><table width="760" border="0">
<tr>
<td width="100" align="center" bgcolor="#00FFFF">帖子序号</td>
<td width="300" align="center" bgcolor="#00FFFF">标题</td>
<td width="100" align="center" bgcolor="#00FFFF">发帖人</td>
<td width="100" align="center" bgcolor="#00FFFF">发帖日期</td>
<td width="90" align="center" bgcolor="#00FFFF">评论数</td>
<td width="40" align="center" bgcolor="#00FFFF">删除</td>
<td width="40" align="center" bgcolor="#00FFFF">修改</td>
</tr>
<%
String sql = null;
if ("manager".equals(role)) { // 枪员示全息
sql = "select * from posts";
}
else { // 通没只示没约
sql = "select * from posts where poster_name='" + session.getAttribute("user_name") + "'";
}
ResultSet rs = db.excuteQuery(sql);
int id = 0;
String title = null;
String author = null;
Date date = null;
int comment_time = 0;
String password = null;
while (rs.next())
{
id = rs.getInt("post_id");
title = rs.getString("post_title");
date = rs.getDate("post_date");
author = rs.getString("poster_name");
comment_time = rs.getInt("response_quantity");
%>
<tr>
<td align="center" bgcolor="#99FF66"><%=id%></td>
<td align="center" bgcolor="#99FF66"><a href="detiles.jsp?id=<%=id%>"><%=title%></a></td>
<td align="center" bgcolor="#99FF66"><%=author%></td>
<td align="center" bgcolor="#99FF66"><%=date.toString()%></td>
<td align="center" bgcolor="#99FF66"><a href="comments.jsp?id=<%=id%>"><%=comment_time%></a></td>
<td align="center" bgcolor="#99FF66"><a href="ArticleServlet?command=delete&id=<%=id%>" onclick="return confirm('确定要删除');">删除</a></td>
<td align="center" bgcolor="#99FF66"><a href="editArticle.jsp?id=<%=id%>">修改</a></td>
</tr>
<%
}
%>
</table></td>
</tr>
</table>
<p> </p>
<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello ${param.name}!
</c:if>
--%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -