📄 rebbsview.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="../error/error.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查看回复</title>
</head>
<jsp:useBean id="rebbsview" class="useBean.Link_db" scope="request" />
<link rel="stylesheet" type="text/css" href="../image/com.css"/>
<%
int id=Integer.parseInt((String)request.getParameter("id"));
rebbsview.update("UPDATE bbs SET 人气 = 人气+"+1+" WHERE 主题id = "+id);
%>
<body>
<table width="717" border="1" align="center" cellpadding="1" cellspacing="0" bordercolordark="#ffffff" bordercolor="#ffffff" bordercolorlight="#0066ff">
<%
String sqli=" SELECT 楼主, 主题, 发表时间, 内容, 电子邮件, 个人主页 FROM bbs,associator WHERE (主题id = '"+id+"') AND (用户名 = 楼主) ORDER BY 主题id DESC ";
Connection con=useBean.Link_db.getCon();
Statement state=con.createStatement();
ResultSet rs=state.executeQuery(sqli);
while(rs.next()){
String username=rs.getString("楼主");
String title=rs.getString("主题");
String totime=rs.getString("发表时间");
String infro=rs.getString("内容");
String email=rs.getString("电子邮件");
String homepage=rs.getString("个人主页");
%>
<tr align="center" bgcolor="#CCCCFF">
<td height="22" colspan="2"><a href="bbs.jsp" class="style10" >发表新贴</a></td>
<td width="332" height="22" bgcolor="#CCCCFF"><a href="rebbs.jsp?id=<%=id%>" class="style10">回复主题</a></td>
</tr>
<tr bgcolor="#EEEEFF">
<td width="148" height="22" align="left">现在主题:</td>
<td height="22" colspan="2" align="left"><%=title%></td>
</tr>
<tr bgcolor="#EEEEFF">
<td height="22" align="left">发贴:<%=username%></td>
<td height="22" colspan="2" rowspan="2" align="left" valign="top"><%=infro%> </td>
</tr>
<tr bgcolor="#EEEEFF">
<td height="22" align="left">Emial;<a href="mailto:<%=email%>"><%=email%></a> </td>
</tr>
<tr bgcolor="#EEEEFF">
<td height="22" align="center"><a href="bbs_del.jsp?id=<%=id%>">删除主题</a></td>
<td width="223" height="22" align="left">发表时间;<%=totime%></td>
<td height="22" align="left"><a href="<%=homepage%>" target="_blank">个人主页</a></td>
</tr>
<%
}
rebbsview.close();
String sqli1="SELECT 回复id,回复主题, 回复人, 回复时间, 回复内容, 电子邮件, 个人主页 FROM tobbs inner join associator on 回复人=用户名 WHERE (回复主题="+id+") ORDER BY 回复id ASC ";
con=useBean.Link_db.getCon();
state=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=state.executeQuery(sqli1);
String color="";
//countpage总页数,sqan宽度,count总纪录数,fpage现在页,fcount现纪录数
String strpages=(String)request.getParameter("pages");
int pages=0;
if(strpages==null){
pages=0;
}else{
pages=Integer.parseInt(strpages);
}
rs.last();
int sqan=3,i=0,fcount=0;
int count=rs.getRow();
rebbsview.update("UPDATE bbs SET 回复 = "+count+" WHERE 主题id = "+id);
int countpage=count/sqan;
if(count%sqan>0) countpage=countpage+1;
fcount=pages*sqan+1;
int fpage=(count-fcount)/sqan+1;
rs.absolute(fcount);
rs.previous();
while(rs.next()){
if(color==""){
color="ffffff";
}else{
color="";
}
int reid=rs.getInt("回复id");
String username1=rs.getString("回复人");
String totime1=rs.getString("回复时间");
String infro1=rs.getString("回复内容");
String email1=rs.getString("电子邮件");
String homepage1=rs.getString("个人主页");
%>
<tr bgcolor="<%=color%>">
<td height="32" align="left">跟贴;<%=username1%></td>
<td colspan="2" rowspan="2" align="left" valign="top"><%=infro1%> </td>
</tr>
<tr bgcolor="<%=color%>">
<td height="32" align="left">Emial;<a href="mailto:<%=email1%>"><%=email1%></a></td>
</tr>
<tr bgcolor="<%=color%>">
<td height="22" align="center"><a href="rebbs_del.jsp?reid=<%=reid%>&id=<%=id%>">删除回复</a></td>
<td width="223" height="22" align="left">发表时间:<%=totime1%></td>
<td height="22" align="left"><a href="<%=homepage1%>" target="_blank">个人主页</a></td>
</tr>
<%
i++;if(i==sqan) break;
}
rebbsview.close();
%>
<tr align="right" bgcolor="#CCCCFF">
<td height="22" colspan="5">第<%=(pages+1)%>/<%=countpage%>页
<%
if(pages<=0){
out.print("上一页");
}else{
%> <a href="rebbsview.jsp?pages=<%=(pages-1)%>&id=<%=id%>">上一页</a>
<%
}
%>
<%
if(pages>=countpage-1){
out.print("下一页");
}else{
%><a href="rebbsview.jsp?pages=<%=(pages+1)%>&id=<%=id%>">下一页</a>
<%
}
%></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -