📄 show.jsp
字号:
<html>
<head>
<title>BBS</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" Href="bbs.css">
</head>
<script language="javascript">
function checkForm() {
if (document.form1.topic.value == "") {
alert("文章的主题不能为空!");
form1.topic.focus();
return false;
}
if (document.form1.email.value != "" && (document.form1.email.value.indexOf("@")<1 || document.form1.email.value.indexOf(".")<1)) {
alert(" eamil地址不合法,请输入正确的地址");
form1.email.focus();
return false;
}
return true;
}
function openWindow(url) {
var newWin = window.open(url,"","toolbar=no,status=no,menubar=no,width=330,height=260");
return false;
}
</script>
<body bgcolor="#FFF9F0">
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="BoardBean" scope="page" class="database.OPDB" />
<%
BoardBean.connection();
Connection conn = BoardBean.getConn();
String id = request.getParameter("id");
String boardid = request.getParameter("boardid");
String sql = "select lasttime,topic,name,face,text,topid,layer,bbsorder,linktopic,linkurl,email from t_bbs";
sql += " where boardid = " + boardid + " and id = " + id;
ResultSet rs = BoardBean.select(conn,sql);
rs.next();
String lasttime = rs.getString("lasttime");
String topic = BoardBean.GBK(rs.getString("topic").trim());
if (topic.length() >= 60) {
topic = topic.substring(0,59) + "......";
}
String nameUncode = rs.getString("name");
String name = BoardBean.GBK(nameUncode);
String face = rs.getString("face");
String text = BoardBean.GBK(rs.getString("text"));
String topid = rs.getString("topid");
String layer = rs.getString("layer");
String bbsorder = rs.getString("bbsorder");
String linktopic = BoardBean.GBK(rs.getString("linktopic"));
String linkurl = rs.getString("linkurl");
String email = rs.getString("email");
rs.close();
String username = (String) session.getValue("username");
if (username == null) {
%>
你只能以过客的名字发表文章,无法取得经验值,如果你没有登陆,请<a Href="logon.jsp" onclick="return openWindow(this.href);"><font color="red">登陆</font></a>,如果你没有注册,请<a href="register.htm" onclick="return openWindow(this.href);"><font color="red">注册!</font></a><p>
<%
}
%>
<font size="3"><b>第<font color="#CC0000"><%= id %></font>帖--<%= topic %></b></font>
<hr color="FF9900" size="1">
热线公告:<font color="0000cc"><b><%= name %></b></font> <%= lasttime %> 这样 <img src = "images/mod<%= face %>.gif"> 写到: 斑竹管理: <a href="delete.jsp?boardid=<%= boardid %>&id=<%= id %>&writename=<%= name %>" onclick="return openWindow(this.href);">删除帖子</a> <a href="addgood.jsp?boardid=<%= boardid %>&id=<%= id %>&writename=<%= name %>" onclick="return openWindow(this.href);">加入精华</a><p>
<table width="100%" border="1" align="center" bordercolor="#FF9900" cellspacing="3" cellpadding="3">
<tr bgcolor="#ffffff">
<td bordercolor="ffffff"><p><% if (text != null) {out.print(text);} else {out.print("没有发布文章正文");}%></p>
<p>
<%
if (linktopic != null) {
if (linkurl != null) {
out.print("<a href='"+linkurl+"'><font color=black>"+linktopic+"</font></a>");
}
else {
out.print(topic);
}
}
out.print("<br>");
if (email != null) {
out.print("email:<a href='mailto:"+email+"'><font color=black>"+email+"</font></a>");
}
%>
</p>
</td>
</tr>
</table><p>
<%
String sql1 = "select count(*) as totals from t_bbs where boardid = " + boardid + " and topid = " + topid;
//out.print(sql1);
ResultSet rs1 = BoardBean.select(conn,sql1);
rs1.next();
int totals = Integer.parseInt(rs1.getString("totals"));
//out.print(totals);
rs1.close();
//显示相关帖子
if (totals >= 2) {
%>
<table width=100% border=0 cellspacing=1 cellpadding=0 align=center>
<tr bgcolor="#FF9900">
<td height="20"><b> 相 关 帖 子</b></td>
</td>
</tr>
</table>
<%
String sql2 = "select id,face,type,txtlong,name,layer,topic,lasttime from t_bbs where boardid = " + boardid + " and topid = " + topid + " order by topid desc,bbsorder";
ResultSet rs2 = BoardBean.select(conn,sql2);
String id2 = "";
String face2 = "";
String type2 = "";
String txtlong2 = "";
String name2 = "";
int layer2,i2;
String listtrip2 = "";
String topic2 = "";
String lasttime2 = "";
while (rs2.next()) {
id2 = rs2.getString("id");
face2 = rs2.getString("face");
type2 = BoardBean.GBK(rs2.getString("type"));
txtlong2 = rs2.getString("txtlong");
name2 = BoardBean.GBK(rs2.getString("name").trim());
layer2 = Integer.parseInt(rs2.getString("layer"));
topic2 = BoardBean.GBK(rs2.getString("topic").trim());
lasttime2 = rs2.getString("lasttime");
//设置树状结构
listtrip2 = " ";
i2 = 1;
while (i2 < layer2) {
listtrip2 = listtrip2 + " ";
i2++;
}
//设置显示的每行内容
%>
<table border="0" cellpadding="0" cellspacing="0"><tr><td><%= listtrip2 %><img src="images/mod<%= face2 %>.gif"> </td><td><a href="show.jsp?boardid=<%= boardid %>&id=<%= id2 %>"><%= topic2 %></a> [<%= type2 %>]-< <%= txtlong2 %> 字节> <%= name2 %> 【<%= lasttime2 %> ID:<%= id2 %>】</td></tr></table>
<%
}
rs2.close();
}
%>
<p>
<table width=100% border=0 cellspacing=1 cellpadding=0 align=center>
<tr bgcolor="#FF9900">
<td height="20"><b> 回 复 帖 子</b></td>
<td width="100" height="20"><img src="images/edit.gif" width="18" height="13">
<%
//修改帖子
if (nameUncode.equals(username) && !nameUncode.equals("过客"))
out.print("<a href=\"update.jsp?boardid="+boardid+"&id="+id+"\"><b>我要改帖子</b></a>");
else
out.print("<b>我要改帖子</b>");
%>
</td><td width="100" height="20"><img src="images/edit.gif" width="18" height="13">
<a href="addnew.jsp?boardid=<%= boardid %>"><b>添加新帖子</b></a></td>
</tr>
</table>
<form action=follow.jsp method=post name="form1">
<table border=0 cellspacing=0 cellpadding=0 align=center width="100%">
<tr>
<td>
<br> 主题<br>
<input name=topic size=50 value="Re:<%= topic %>" >
<input type="hidden" name="boardid" value="<%= boardid %>">
<input type="hidden" name="topid" value="<%= topid %>">
<input type="hidden" name="layer" value="<%= layer %>">
<input type="hidden" name="bbsorder" value="<%= bbsorder %>">
<input type="hidden" name="writename" value="<%= name %>">
<select name="type" >
<option value="原创">原创</option>
<option value="转帖">转帖</option>
</select>
</p>
</td>
</tr>
<tr>
<td valign="top"><br>
表情
<table width="350" border="0">
<tr>
<td>
<input type="radio" name="face" value="1" checked>
<img src="images/mod1.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="2">
<img src="images/mod2.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="3">
<img src="images/mod3.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="4">
<img src="images/mod4.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="5">
<img src="images/mod5.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="6">
<img src="images/mod6.gif" width="20" height="20"></td>
</tr>
<tr>
<td>
<input type="radio" name="face" value="7">
<img src="images/mod7.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="8">
<img src="images/mod8.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="9">
<img src="images/mod9.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="10">
<img src="images/mod10.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="11">
<img src="images/mod11.gif" width="20" height="20"></td>
<td>
<input type="radio" name="face" value="12">
<img src="images/mod12.gif" width="20" height="20"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<p> <br>
发表文章(最多2000字)<br>
<textarea name=text cols=70 rows=10 ></textarea>
</p>
</td>
</tr>
<tr>
<td> <br>
电子邮件:
<input name=email size=40 >
</td>
</tr>
<tr>
<td> 链接标题:
<input name=linktopic size=40 >
</td>
</tr>
<tr>
<td> 链接地址:
<input name=linkurl size=40 >
</td>
</tr>
</table><p>
<table border=0 cellspacing=0 cellpadding=0 align=center>
<tr>
<td align="center">
<table width="50%" border="0">
<tr>
<td>
<input type="submit" name="Submit2" value="发表" onclick="return checkForm();">
</td>
<td>
<input type="reset" name="Submit3" value="重写">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<p>
<div align=center><hr color="FF9900" size=1>
<p align="center"> <a href="../index.jsp" target="_top">返 回 首 页</a>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -