📄 articlelist.jsp
字号:
<%@page contentType="text/html"%>
<%@page pageEncoding="GB2312"%>
<%@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"%>
--%>
<script language="javascript">
function check(p)
{
var password = prompt("请输入删除密码","");
return password == p;
}
</script>
<!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(photoes/bg.gif);
}
.STYLE1 {font-size: 36px}
-->
</style></head>
<body>
<div id="container" style="background-color: #ffffff;height:570px;width:850px;margin-left:65px;margin-right:auto;">
<div id="head" align="center">
<div style="float:left;background-color: #000000;height:100px;">
<td><img src="photoes/logo.gif"></td>
</div>
<div style="float:right;height:100px;width:595px;background-color: #000000;">
<div style="margin-top:20px;margin-right:20px;font-size:30px;font-family: fantasy;color: #ffffff;">ALL--ST@R . FOURM</div>
</div>
</div>
<div id="a"><hr width="850px;"></div>
<div style="margin-left:20px;margin-top:10px; width:830px;">
<table border="0" align="left">
<tr>
<td align="left">
<%
String user_id = (String)session.getAttribute("user_id");
String role = "user";
if( user_id != null)
{
if(user_id.equals("1012")){
role = "manager";
}
}else
{
role="visitor";
}
if ("user".equals(role) || "manager".equals(role)) {
%>
<a href="UserServlet?command=layout"><img border="0" src="tubiao7.jpg" width="52" height="52"></a>
<%
}
else {
%>
<a href="index.jsp"><img border="0" src="tubiao.jpg" width="52" height="52"></a>
<a href="newUser.jsp"><img border="0" src="tubiao1.jpg" width="52" height="52"></a>
<%
}
%>
<a href="newArticle.jsp"><img border="0" src="tubiao2.jpg" width="52" height="52"></a>
<a href="managerArticle.jsp?role=<%=role%>"><img border="0" src="tubiao3.jpg" width="52" height="52"></a>
<%
if ("manager".equals(role)) {
%>
<a href="managerComments.jsp"><img border="0" src="tubiao4.jpg" width="52" height="52"></a>
<%
}
%>
</td>
</tr>
</table>
</div>
<div style="float:left;">
<table>
<tr>
<td><table width="760" border="0">
<tr>
<td width="100" align="center" bgcolor="#00FFFF"><p style="font-size:18px;font-family: cursive;">帖子序号</p></td>
<td width="300" align="center" bgcolor="#00FFFF"><p style="font-size:18px;font-family: cursive;">帖子标题</p></td>
<td width="100" align="center" bgcolor="#00FFFF"><p style="font-size:18px;font-family: cursive;">发帖人</p></td>
<td width="100" align="center" bgcolor="#00FFFF"><p style="font-size:18px;font-family: cursive;">发帖日期</p></td>
<td width="90" align="center" bgcolor="#00FFFF"><p style="font-size:18px;font-family: cursive;">评论数</p></td>
</tr>
<%
ResultSet rs = db.excuteQuery("select * from posts");
int id = 0;
String title = null;
String author = null;
Date date = null;
int comment_time = 0;
int count=0;
while (rs.next())
{
count++;
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 height="40" align="center" bgcolor="#99FF66"><%=count%></td>
<td align="center" width="100" bgcolor="#99FF66"><a href="detiles.jsp?id=<%=id%>"><%=title%></a></td>
<td align="center" bgcolor="#99FF66"><div style="margin-top:2px; margin-left:4px; margin-bottom:2px;float:left;"><img style="height:40px;" src="photoes/liu.jpg"></img></div><div style="margin-top:7px;"><%=author%></div></td>
<td align="center" bgcolor="#99FF66"><%=date.toString()%></td>
<td align="center" bgcolor="#99FF66"><a href="comments.jsp?id=<%=id%>"><%=comment_time%></a></td>
</tr>
<%
}
%>
</table></td>
</tr>
</table>
<form action="interestedtopic.jsp" method="post" name="form1" id="form2">
<p>在这里搜搜看你感兴趣的话题
<label>
<input type="text" name="interestedtopic" />
</label>
<input type="submit" name="Submit" class="STYLE3" value=" 搜索 " />
</p>
<p>
<label></label>
</p>
</form>
</div>
<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>
--%>
</div>
<div id="footer" style="width:850px;margin-left:65px; text-align:center;background-image: url(photoes/footer.gif);">
<div style="margin-top:20px;" id="footer_text">
版权所有:钱宣统 邮箱 <a href="#">qxt@126.com</a>
</div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -