📄 soulview.jsp
字号:
<%--
File Name:soulview.jsp
Author:fancy
Date:2001.6.1
Usage:view the soul topic
Address:Peking University 37#215,62762526,fancyrainbow@263.net,bbs.pku.edu.cn(id:javalover)
Note:1.这是一个Open Source项目,你可以自由的获取,修改,传播本项目的代码,无需经过本人的同意。
2.你不可以将本项目的源代码用于商业应用,除非获得本人的书面允许。
3.本项目的核心源代码所有权归原开发者所有,如果需要获取最新的核心代码,请与本人联系
--%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Java论坛</title>
</head>
<%@ include file="defaultcss.jsp"%>
<%@ include file="menuaction.jsp"%>
<%@ include file="database.jsp" %>
<%
//获取文章的信息。
String idstr=request.getParameter("id");
int currid=Integer.parseInt(idstr);
String topicSQL="SELECT * FROM datafavourite where id="+currid;
java.sql.Statement stmtTopic=conn.createStatement();
ResultSet rsTopic=stmtTopic.executeQuery(topicSQL);
rsTopic.next();
String group=rsTopic.getString(2);
String engroup=rsTopic.getString(3);
String topic=rsTopic.getString(1);
String author=rsTopic.getString(4);
int replycount=rsTopic.getInt(11);
Date posttime=rsTopic.getDate(7);
String content=rsTopic.getString(6);
String ipaddr=rsTopic.getString(9);
String mark=rsTopic.getString(14);
rsTopic.close();
stmtTopic.close();
//查询该文章所在的group的信息(-),包括总的文章数目,最小的id号,最大的id号 。
String topicSQL2="SELECT * FROM datafavourite where groupenname="+"'"+engroup.toLowerCase()+"' ORDER BY id";
//out.println(topicSQL2);
java.sql.Statement stmtTopic2=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rsTopic2=stmtTopic2.executeQuery(topicSQL2);
rsTopic2.last();
int totalRow=rsTopic2.getRow();
int maxid=rsTopic2.getInt(13);
rsTopic2.first();
int minid=rsTopic2.getInt(13);
rsTopic2.close();
stmtTopic2.close();
//获取当前文章的前一个id号,后一个id号
String firstlink="<a href=soulview.jsp?id="+minid+">";
String lastlink="<a href=soulview.jsp?id="+maxid+">";
String prevlink="";
String nextlink="";
String backlink="</a>";
String prevSQL="";
String nextSQL="";
String editlink="";
String deletelink="";
java.sql.Statement stmtindex=conn.createStatement();
if(currid==minid)
{
prevlink="<a href=soulview.jsp?id="+currid+">";
nextSQL="SELECT * FROM datafavourite where groupenname="+"'"+engroup.toLowerCase()+"' and id>"+currid+" ORDER BY id";
ResultSet rstemp=stmtindex.executeQuery(nextSQL);
if(rstemp!=null)
{
rstemp.next();
nextlink="<a href=soulview.jsp?id="+rstemp.getInt(13)+">";
rstemp.close();
}
else
{
nextlink="<a href=soulview.jsp?id="+maxid+">";//防止当前group仅有一篇文章的情况。
}
}
else if(currid==maxid)
{
nextlink="<a href=soulview.jsp?id="+maxid+">";
prevSQL="SELECT * FROM datafavourite where groupenname="+"'"+engroup.toLowerCase()+"' and id<"+currid+" ORDER BY id DESC";
ResultSet rstemp=stmtindex.executeQuery(prevSQL);
if(rstemp!=null)
{
rstemp.next();
prevlink="<a href=soulview.jsp?id="+rstemp.getInt(13)+">";
rstemp.close();
}
else
{
prevlink="<a href=soulview.jsp?id="+minid+">";//防止当前group仅有一篇文章的情况。
}
}
else
{
prevSQL="SELECT * FROM datafavourite where groupenname="+"'"+engroup.toLowerCase()+"' and id<"+currid+" ORDER BY id DESC";
ResultSet rstemp1=stmtindex.executeQuery(prevSQL);
//out.println(prevSQL);
rstemp1.next();
prevlink="<a href=soulview.jsp?id="+rstemp1.getInt(13)+">";
rstemp1.close();
nextSQL="SELECT * FROM datafavourite where groupenname="+"'"+engroup.toLowerCase()+"' and id>"+currid+" ORDER BY id";
//out.println(nextSQL);
ResultSet rstemp2=stmtindex.executeQuery(nextSQL);
//out.println(prevSQL);
rstemp2.next();
nextlink="<a href=soulview.jsp?id="+rstemp2.getInt(13)+">";
rstemp2.close();
}
stmtindex.close();
//查询当前文章所在板块的情况(二),包括斑竹的名字。
String groupSQL="SELECT * FROM forumgroup where groupenname="+"'"+engroup.toLowerCase()+"'";
java.sql.Statement stmtGroup=conn.createStatement();
ResultSet rsGroup=stmtGroup.executeQuery(groupSQL);
rsGroup.next();
String adminuser=rsGroup.getString(4);
rsGroup.close();
stmtGroup.close();
//获取用户的情况,包括签名档,昵称。
String userSQL="SELECT * FROM forumuser where username="+"'"+author+"'";
java.sql.Statement stmtUser=conn.createStatement();
ResultSet rsUser=stmtUser.executeQuery(userSQL);
rsUser.next();
String nickname=rsUser.getString(2);
String sign=rsUser.getString(8);
rsUser.close();
stmtUser.close();
//利用StringTokenizer类给文章的正文分行。
java.util.StringTokenizer st = new java.util.StringTokenizer(content);
String _content="";
content=_content;
while (st.hasMoreTokens())
{
content+=st.nextToken()+"<br>";
}
//包装文章正文的显示形式。
content="在"+author+"["+nickname+"]"+"的大作中提到:<br>"+content;
content+="<br><br>来源于:"+ipaddr+"<br>签名档:"+sign;
%>
<%
//设定Session,可能用不上
session.putValue("prevlink",prevlink);
session.putValue("nextlink",nextlink);
session.putValue("firstlink",firstlink);
session.putValue("lastlink",lastlink);
session.putValue("editlink",editlink);
session.putValue("deletelink",deletelink);
session.putValue("backlink",backlink);
%>
<body LANGUAGE=javascript onload="return window_onload()">
<table border="0" width="100%" height="521" cellspacing="0" cellpadding="0">
<%@ include file="toptable.jsp"%>
<tr>
<td width="2%" height="13"></td>
<td width="92%" height="32" colspan="5" rowspan="2">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="80%" height="26">
<tr bgcolor="#efefef">
<td width="25%" height="24"></td>
<td width="50%" height="24" align="center"><font color="red" size="2">Java技术讨论区精华区(<%=group%>信区)</font></td>
<td width="25%" height="24"></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
<tr>
<td width="2%" height="13"></td>
</tr>
<tr>
<td width="2%" height="16"></td>
<td width="2%" height="284" rowspan="18" background="img/shu.gif"> </td>
<td width="92%" height="284" colspan="5" rowspan="18">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="1" width="99%" height="246">
<tr>
<td width="10%" height="29" align="center"><font color="blue" size="2"></font></td>
<td width="40%" height="29" align="center"><font color="blue" size="2">文章数:<%=totalRow%></font></td>
<td width="18%" height="29" align="center"></td>
<td width="7%" height="29" align="center"><font color="blue" size="2"></font></td>
<td width="25%" height="29" align="center" colspan="2"><font color="red" size="2">斑竹:<%=adminuser%></font></td>
</tr>
<tr bgcolor='#DCEDED'>
<td width='10%' height='29' ><font color='blue' size="2">编号</font></td>
<td width='40%' height='29'><font color='blue'size='2'>主题</font></td>
<td width='18%' height='29' ><font color='blue'size='2'>作者</font></td>
<td width='7%' height='29' align='center'><font color='blue'size='2'>回文数</font></td>
<td width='20%' height='29' align='center'><font color='blue'size='2'>发表时间</font></td>
<td width='5%' height='29' align='center'><font color='blue'size='2'>状态</font></td>
</tr>
<tr bgcolor='#efefef'>
<td width='10%' height='41'><font color='blue' size='2'><%=currid%></font></td>
<td width='40%' height='41'><font color='blue' size='2'><%=topic%></font></td>
<td width='18%' height='41'><font color='blue' size='2'><a href="viewuser.jsp?key=<%=author%>"><%=author%></a></font></td>
<td width='7%' height='41'><font color='blue' size='2'><%=replycount%></font></td>
<td width='20%' height='41'><font color='blue' size='2'><%=posttime%></font></td>
<td width='5%' height='41' align="center"><font color='blue' size='2'><%=mark%></font></td>
</tr>
<tr>
<td width='100%' height='37' colspan="6"><font color="black" size="2"><%=content%></font></td>
</tr>
</table>
</center>
</div>
</td>
<td width="2%" height="284" rowspan="18"></td>
<td width="2%" height="284" rowspan="18" background="img/shu.gif"> </td>
</tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="16"></td></tr>
<tr><td width="2%" height="12"></td></tr>
<tr>
<td width="2%" height="41" rowspan="2"></td>
<td width="2%" height="41" background="img/shu.gif" rowspan="2"> </td>
<td width="92%" height="27" colspan="5">
<font color="blue" size="2">
|
<%=firstlink%>第一页<%=backlink%>
|
<%=prevlink%>上一页<%=backlink%>
|
<%=nextlink%>下一页<%=backlink%>
|
<%=lastlink%>末一页<%=backlink%>
|
</font>
<input type="hidden" value="<%=currid%>" name="id">
</td>
<td width="2%" height="41" rowspan="2" background="img/shu.gif"> </td>
<td width="2%" height="41" background="img/shu.gif" rowspan="2"> </td>
</tr>
<tr><td width="92%" height="18" colspan="5" background="img/bottom.gif"></td></tr>
</table>
<%@ include file="soulmenu.jsp"%>
<%
conn.close();
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -