?? showcontent.java
字號(hào):
package mybbs;
import java.util.*;
import java.sql.*;
import javax.servlet.http.HttpSession;
public class ShowContent {
public ShowContent() {
}
HttpSession session=null;
private int postid=0;
private int j=0;
private int istopic=1;
private int groupid=0;
private String title;
public Vector ListContent(String forumid,String topicid,HttpSession session) throws Exception{
this.session=session;
Vector VCon=new Vector();
DBConn conn=new DBConn();
ResultSet rs=null;
int power=0;
String forum="";
String userid="";
if(session.getAttribute("userpower")!=null){
power=Integer.parseInt((String)session.getAttribute("userpower"));
}
if(session.getAttribute("forum")!=null){
forum=(String)session.getAttribute("forum");
}
if(session.getAttribute("userid")!=null){
userid=(String)session.getAttribute("userid");
}
String sql="SELECT posts.*,bbsuser.* FROM posts,bbsuser WHERE posts.isdel=0 AND posts.forumid="
+forumid+" AND posts.topic_id="+topicid
+" AND posts.author_id=bbsuser.id ORDER BY posts.id ASC";
rs=conn.query(sql);
int i=1;
while(rs.next())
{
StringBuffer buffer=new StringBuffer();
if (rs.getInt("istopic") > 0) {
j = rs.getInt("posts.islock");
title=rs.getString("title");
postid = rs.getInt("posts.id");
groupid = rs.getInt("posts.groupid");
istopic=rs.getInt("istopic");
}
/*-------------------------------------------------------------------*/
buffer.append("<TABLE align=center cellSpacing=0 cellPadding=1 width=\"98%\" border=0>");
buffer.append("<TBODY><TR>");
if(i==1)
buffer.append("<TD width=\"18%\" background=images/part1_38.gif height=28>");
else
buffer.append("<TD width=\"18%\" bgcolor=\"#f4f8e0\" height=28>");
//改一下顏色
if(rs.getInt("online")==1)
buffer.append(" <FONT color=red>作 者:"+rs.getString("bbsuser.nickname")+"</FONT>");
else
buffer.append(" 作 者:"+rs.getString("bbsuser.nickname"));
buffer.append("</TD>");
if(i==1)
buffer.append(" <TD width=\"58%\" background=images/part1_38.gif>");
else
buffer.append(" <TD width=\"58%\" bgcolor=\"#f4f8e0\">");
if(i==1){
buffer.append("<FONT color=red>[樓主]</FONT>");
}
else{
buffer.append("<FONT color=red>["+i+"樓]</FONT>");
}
buffer.append(" 主題:"+rs.getString("title")+"</TD>");
if(i==1)
buffer.append("<TD width=\"20%\" background=images/part1_38.gif>");
else
buffer.append("<TD width=\"20%\" bgcolor=\"#f4f8e0\">");
buffer.append("<B>Posted:</B>"+rs.getString("post_time").substring(0,16));
buffer.append("</TD></TR></TBODY></TABLE>");
buffer.append("<TABLE align=center cellSpacing=0 cellPadding=1 width=\"98%\" border=0>");
buffer.append("<TBODY><TR>");
buffer.append(" <TD vAlign=top width=\"18%\" bgColor=#f4d8f2 rowSpan=2>");
buffer.append(" <IMG width=130 height=130 src=\""+rs.getString("face")+"\" />");
buffer.append("<BR> 等級(jí):"+rs.getString("usergrade"));
buffer.append("<BR> 文章:"+rs.getString("totalpost"));
buffer.append("<BR> 積分:"+rs.getString("userscore"));
buffer.append("<BR> 加入時(shí)間:"+rs.getString("reg_time").substring(0,10));
buffer.append("<BR> 最后登陸:"+rs.getString("bbsuser.last_time").substring(0,10));
buffer.append("<BR></TD>");
buffer.append("<TD width=\"77%\" vAlign=center align=center bgColor=#f4f8fb >");
//buffer.append(" ");
buffer.append("<TABLE width=90% cellSpacing=0 cellPadding=0 border=0>");
buffer.append("<TBODY> <TR><TD width=14><IMG height=8 src='images/top_l.gif' width=14></TD>");
buffer.append("<TD background='images/top_c.gif'></TD>");
buffer.append("<TD width=16><IMG height=8 src='images/top_r.gif' width=16></TD>");
buffer.append("</TR>");
buffer.append("<TR><TD vAlign=top width=14 background='images/center_l.gif'></TD>");
buffer.append("<TD style='LINE-HEIGHT: 14pt' bgColor=#fffff1>");
buffer.append(rs.getString("content")+"</TD>");
buffer.append("<TD vAlign=top width=16 background='images/center_r.gif'>");
buffer.append(" <IMG height=8 src='' width=16></TD></TR>");
buffer.append("<TR> <TD vAlign=top width=14><IMG height=42 src='images/foot_l1.gif' width=14></TD>");
buffer.append("<TD background='images/foot_c.gif'><IMG height=42 src='images/foot_l3.gif' width=36></TD>");
buffer.append("<TD align=right width=16><IMG height=42 src='images/foot_r.gif' width=16></TD>");
buffer.append("</TR></TBODY></TABLE><BR>");
buffer.append("</TD></TR>");
buffer.append("<TR><TD width=\"77%\" vAlign=bottom bgColor=#f4f8fb > ");
buffer.append("<IMG src='images/sigline.gif' align=absBottom><BR>");
buffer.append(" "+rs.getString("signature")+"<BR>");
buffer.append("</TD></TR></TBODY></TABLE>");
buffer.append("<TABLE align=center cellSpacing=0 cellPadding=1 width=\"98%\" border=0>");
buffer.append("<TBODY> <TR>");
buffer.append("<TD width=\"18%\" height=25 bgcolor=\"#6699FF\" >");
buffer.append(" <IMG src='images/pc.gif'>");
if(power>10||forum.equals(forumid)){
buffer.append(rs.getString("post_ip"));
}
buffer.append("</TD>");
buffer.append("<TD width=\"58%\" bgcolor=\"#8BB7F1\" >");
buffer.append("<A href='user_info.do?userid="+rs.getString("bbsuser.id")+"'>");
buffer.append("<IMG alt=查看作者資料 src='images/profile.gif' ></A> ");
buffer.append("<A href='"+rs.getString("weblog")+"'>");
buffer.append("<IMG alt=博客 src='images/weblog.gif' ></A> ");
buffer.append("<A href='search.do?nickname="+rs.getString("nickname")+"'>");
buffer.append("<IMG alt=搜索與之相關(guān)貼子 src='images/search.gif' ></A> ");
buffer.append("<A href='mailto:"+rs.getString("email")+"'>");
buffer.append("<IMG alt=發(fā)電子郵件 src=\"images/emailto.gif\" ></A> ");
buffer.append("<IMG alt="+rs.getString("skype")+" src=\"images/skype.gif\" > ");
buffer.append(" </TD>");
buffer.append("<TD align=right width=\"20%\" bgcolor=\"#8BB7F1\">");
if(power>10||forum.equals(forumid))
{
buffer.append("<A href='adminAction.do?motion=2&postid="+rs.getString("posts.id")+"&forumsid="+forumid+"'>");
buffer.append("<IMG alt=刪除這個(gè)帖子 src='images/quote.gif' align=absMiddle></A>");
}
if(power>10||userid.equals(rs.getString("bbsuser.id")))
{
buffer.append("<A href='post.do?postid=" + rs.getString("posts.id") +
"&action=4'>");
buffer.append("<IMG alt=編輯這個(gè)帖子 src='images/edit.gif' ></A> ");
}
buffer.append(" <A href='javascript:scroll(0,0)'><IMG alt=頂端 src='images/top.gif'></A>");
buffer.append("</TD></TR></TBODY></TABLE>");
VCon.add(buffer);
buffer=null;
i++;
/*-------------------------------------------------------------------*/
}
rs.close();
return VCon;
}
public int getPostid(){
return postid;
}
public int getGroupid(){
return groupid;
}
public int getIstopic(){
return istopic;
}
public int getIslock(){
return j;
}
public String getTitle(){
return title;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -