BBS论坛详细设计说明书Word格式.docx
《BBS论坛详细设计说明书Word格式.docx》由会员分享,可在线阅读,更多相关《BBS论坛详细设计说明书Word格式.docx(13页珍藏版)》请在冰豆网上搜索。
三、BBS前台的详细设计
用户注册界面
BBS前台用户的登陆
关于前台的登录
response.setContentType("
text/html;
charset=gb2312"
);
PrintWriterout=response.getWriter();
Stringusername=request.getParameter("
username"
Stringpass=request.getParameter("
password"
System.out.println("
aaaaaaa"
+username+"
"
+pass);
Useru=UserDao.setUserInfo(username,pass);
if(u!
=null){
request.getSession().setAttribute("
user"
u);
request.getRequestDispatcher("
MPart"
).forward(request,response);
}else{
Login.jsp"
}
out.flush();
out.close();
}
BBS主板块界面
关于代码
Vector<
Part>
partdata=PDao.sqlPartAll();
Comment>
vcomment=newVector<
();
for(inti=0;
i<
partdata.size();
i++){
intpartid=partdata.elementAt(i).getId();
try{
Commentc=CommentDao.getLastComment(partid);
Stringdate=c.getDate();
Stringtime=CommonUtil.getCommentDate(date);
c.setDate(time);
Stringtitle=c.getName();
if(title!
if(title.length()>
12){
Stringx=title.substring(0,12);
x=x+"
..."
;
c.setName(x);
}
vcomment.addElement(c);
}
}catch(Exceptione){
e.toString();
}
request.setAttribute("
lastcomments"
vcomment);
//最后的回贴
PartData"
partdata);
request.getRequestDispatcher("
main.jsp"
BBS发贴界面
关于代码
request.setCharacterEncoding("
gb2312"
//修改request编码方式
Stringtype=request.getParameter("
gototype"
//通过标记判断跳转而来的页面
intid=Integer.parseInt(request.getParameter("
partid"
));
//获取版块id
Stringtitle=request.getParameter("
title"
Stringtext=request.getParameter("
FCKBack"
if(type.equals("
0"
)){//如果为0则表示从comment.jsp跳转而来,要判断是否合法
Useru=(User)request.getSession().getAttribute("
if(u==null){//未登录则跳转至登陆页面
response.sendRedirect("
}else{//登录用户跳转至发帖页面
request.setAttribute("
id);
request.getRequestDispatcher("
AddComment.jsp"
).forward(request,response);
}else{//表示从AddComment.jsp跳转而来
Dated=newDate();
SimpleDateFormatsdf=newSimpleDateFormat("
yyyy-MM-ddHH:
mm:
ss"
Stringtime=sdf.format(d);
//格式化日期
Useru=(User)request.getSession().getAttribute("
intuid=u.getId();
//用户id
DBConnectdb=newDBConnect();
try{
Stringsql="
insertintobbs_commentvalues('
"
+title+"
'
'
+text+"
"
+uid+"
+time+"
+id+"
0,1)"
//编写sql语句
inti=db.executeUpdate(sql);
if(i>
0){//如果大于0则表示插入数据库成功
CommentServlet?
partid="
+id).forward(request,response);
e.printStackTrace();
BBS用户注册界面
四、BBS后台的详细设计
BBS后台管理系统
BBS后台添加板块
request.setCharacterEncoding("
type"
StringmpName=request.getParameter("
mpName"
mpName:
+mpName);
if(type!
if(type.equals("
)){
Stringtime=CommonUtil.getTime(newDate());
inti=0;
try{
i=db.executeUpdate("
insertintobbs_partvalues('
+mpName+"
1,0,null)"
}catch(Exceptione){
e.printStackTrace();
0){
message"
主版块添加成功-("
)"
}elseif(type.equals("
1"
)){//添加子版块
StringminiPartName=request.getParameter("
minipName"
Stringmpartid=request.getParameter("
mpSelect"
+miniPartName+"
1,"
+mpartid+"
null)"
//TODOAuto-generatedcatchblock
子版块添加成功-("
mainparts"
AddPart.jsp"
BBS后台修改板块
request.setCharacterEncoding("
//主版块加入request范围
Stringtype=request.getParameter("
Stringpartid=request.getParameter("
+partid);
if(type!
=null){
DBConnectdb=newDBConnect();
Stringnewmpname=request.getParameter("
newMPName"
//获取主版块新名称
Stringmpid=request.getParameter("
mpmodifyselect"
db.executeUpdate("
updatebbs_partsetname='
+newmpname+"
whereid="
+mpid);
Stringnewsonname=request.getParameter("
newSonName"
//获取子版块新名称
Stringsonid=request.getParameter("
sonpartselect"
+newsonname+"
+sonid);
if(partid!
Vector<
sonparts=PDao.sqlPart(Integer.parseInt(partid));
request.setAttribute("
partid);
//将主版块id放置进request内
sonparts"
sonparts);
ModifyPart.jsp"
BBS后台删除板块
//主版块加入request范围
Stringpartida=request.getParameter("
partida"
mpdeleteselect"
updatebbs_partsetstatus=0whereid="
if(partida!
sonparts=PDao.sqlPart(Integer.parseInt(partida));
partida);
DeletPart.j