package com.yxq.action;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.actions.DispatchAction;
import org.apache.struts.util.LabelValueBean;
import com.yxq.actionform.AbleForm;
import com.yxq.actionform.BoardForm;
import com.yxq.actionform.ClassForm;
import com.yxq.actionform.UserForm;
import com.yxq.dao.OpDB;
import com.yxq.tools.Change;
public class AdminAction extends DispatchAction {
/** 置顶帖子 */
public ActionForward setTopBbs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
HttpSession session=request.getSession();
session.setAttribute("mainPage","/pages/show/bbs/openRootShow.jsp");
String forwardPath="error";
String bbsId=request.getParameter("bbsId");
if(bbsId!=null&&!bbsId.equals("")){
Date date=new Date();
String today=Change.dateTimeChange(date);
String sql="update tb_bbs set bbs_isTop='1', bbs_toTopTime=? where bbs_id=?";
Object[] params={today,bbsId};
ActionMessages messages=new ActionMessages();
OpDB myOp=new OpDB();
int i=myOp.OpUpdate(sql, params);
if(i<=0){
System.out.println("置顶帖子出错!");
forwardPath="error";
messages.add("userOpR",new ActionMessage("luntan.bbs.top.E"));
}
else{
System.out.println("置顶帖子成功!");
forwardPath="success";
messages.add("userOpR",new ActionMessage("luntan.bbs.top.S"));
}
saveErrors(request,messages);
}
return mapping.findForward(forwardPath);
}
/** 设为精华帖子 */
public ActionForward setGoodBbs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
String forwardPath="error";
String bbsId=request.getParameter("bbsId");
if(bbsId!=null&&!bbsId.equals("")){
Date date=new Date();
String today=Change.dateTimeChange(date);
String sql="update tb_bbs set bbs_isGood='1', bbs_toTopTime=? where bbs_id=?";
Object[] params={today,bbsId};
ActionMessages messages=new ActionMessages();
OpDB myOp=new OpDB();
int i=myOp.OpUpdate(sql, params);
if(i<=0){
System.out.println("设为精华帖子失败!");
forwardPath="error";
messages.add("userOpR",new ActionMessage("luntan.bbs.good.E"));
}
else{
System.out.println("设为精华帖子成功!");
forwardPath="success";
messages.add("userOpR",new ActionMessage("luntan.bbs.good.S"));
}
saveErrors(request,messages);
}
return mapping.findForward(forwardPath);
}
/** 删除回复帖 */
public ActionForward deleteAnswerBbs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
String forwardPath="error";
String delbbsId=request.getParameter("delbbsAnswerId");
if(delbbsId!=null&&!delbbsId.equals("")){
String sql="delete from tb_bbsAnswer where bbsAnswer_id=?";
Object[] params={delbbsId};
ActionMessages messages=new ActionMessages();
OpDB myOp=new OpDB();
int i=myOp.OpUpdate(sql, params);
if(i<=0){
System.out.println("删除回复帖失败!");
forwardPath="error";
messages.add("userOpR",new ActionMessage("luntan.bbs.deleteAnswerR.E"));
}
else{
System.out.println("删除回复帖成功!");
forwardPath="success";
messages.add("userOpR",new ActionMessage("luntan.bbs.deleteAnswerR.S"));
}
saveErrors(request,messages);
}
return mapping.findForward(forwardPath);
}
/** 后台-列表查看论坛类别 */
public ActionForward getClassList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
HttpSession session=request.getSession();
session.setAttribute("backMainPage","../class/classListShow.jsp");
OpDB myOp=new OpDB();
List classList=myOp.OpClassListShow();
session.setAttribute("backClassList",classList);
return mapping.findForward("success");
}
/** 后台-修改论坛类别 */
public ActionForward modifyClass(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
HttpSession session=request.getSession();
session.setAttribute("backMainPage","../class/classModify.jsp");
String forwardPath="";
String classId=request.getParameter("classId");
if(classId==null)
classId="";
OpDB myOp=new OpDB();
ClassForm classForm=(ClassForm)form;
String validate=request.getParameter("validate");
if(validate==null||validate.equals("")||!validate.equals("yes")){
forwardPath="showModifyJSP";
String sql="select * from tb_class where class_id=?";
Object[] params={classId};
ClassForm classSingle=myOp.OpClassSingleShow(sql, params);
classForm.setClassId(classSingle.getClassId());
classForm.setClassName(classSingle.getClassName());
classForm.setClassIntro(classSingle.getClassIntro());
}
else{
ActionMessages messages=new ActionMessages();
classId = classForm.getClassId();
String className=Change.HTMLChange(classForm.getClassName());
String classIntro=Change.HTMLChange(classForm.getClassIntro());
String sql="update tb_class set class_name=?,class_intro=? where class_id=?";
Object[] paramsMo={className,classIntro,classId};
int i=myOp.OpUpdate(sql, paramsMo);
if(i<=0){
System.out.println("更新论坛类别失败!");
forwardPath="error";
messages.add("adminOpR",new ActionMessage("luntan.admin.modify.class.E"));
}
else{
System.out.println("更新论坛类别成功!");
session.setAttribute("backMainPage","../class/classListShow.jsp");
forwardPath="success";
messages.add("adminOpR",new ActionMessage("luntan.admin.modify.class.S"));
}
saveErrors(request,messages);
}
return mapping.findForward(forwardPath);
}
/** 后台-添加论坛类别 */
public ActionForward addClass(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
HttpSession session=request.getSession();
session.setAttribute("backMainPage","../class/classAdd.jsp");
String validate=request.getParameter("validate");
if(validate==null||validate.equals("")||!validate.equals("yes")){
return mapping.findForward("result");
}
else{
ActionMessages messages=new ActionMessages();
ClassForm classForm=(ClassForm)form;
String className=Change.HTMLChange(classForm.getClassName());
String classIntro=Change.HTMLChange(classForm.getClassIntro());
String sql="";
Object[] params=null;
OpDB myOp=new OpDB();
sql="select * from tb_class where class_name=?";
params=new Object[1];
params[0]=className;
if(myOp.OpClassSingleShow(sql, params)!=null){
System.out.println("添加论坛类别-名称:"+className+" 的论坛已经存在!");
messages.add("adminOpR",new ActionMessage("luntan.admin.add.class.exist",className));
}
else{
sql="insert into tb_class values(?,?)";
params=new Object[2];
params[0]=className;
params[1]=classIntro;
int i=myOp.OpUpdate(sql, params);
if(i<=0){
System.out.println("添加论坛类别失败!");
messages.add("adminOpR",new ActionMessage("l
没有合适的资源?快使用搜索试试~ 我知道了~
BBS-forum.rar_bbs-forum_论坛
共178个文件
gif:57个
jsp:33个
jpg:28个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 120 浏览量
2022-09-24
19:42:39
上传
评论
收藏 703KB RAR 举报
温馨提示
本系统共分为三种操作权限,分别为普通用户、管理员、版主: 普通用户:普通用户只可以发表帖子、回复帖子、查看自己发表的帖子及查看精华帖子。 版主:可以发表帖子、回复帖子、删除自己发布的帖子及帖子回复。 管理员:管理员可以管理用户信息及设置用户权限(普通用户或版主),论坛类别管理、版面管理、发表帖子、删除帖子、设置精华帖了及置顶帖子。
资源推荐
资源详情
资源评论
收起资源包目录
BBS-forum.rar_bbs-forum_论坛 (178个子文件)
AdminAction.class 17KB
BbsAction.class 13KB
OpDB.class 12KB
LogXAction.class 6KB
BbsForm.class 5KB
UserForm.class 4KB
SearchAction.class 4KB
IndexAction.class 3KB
CreatePage.class 3KB
DB.class 3KB
OwnAction.class 3KB
BoardForm.class 3KB
AdminAccess.class 2KB
UserAccess.class 2KB
BbsAnswerForm.class 2KB
ClassForm.class 2KB
SearchForm.class 2KB
MySuperAction.class 1KB
Change.class 1KB
ToChinese.class 896B
AbleForm.class 568B
JumpForm.class 565B
style.css 580B
user0.gif 19KB
user20.gif 18KB
user21.gif 18KB
user22.gif 18KB
user19.gif 17KB
mess.gif 16KB
user11.gif 3KB
user9.gif 3KB
user13.gif 3KB
user14.gif 3KB
user2.gif 3KB
user18.gif 3KB
user7.gif 3KB
user6.gif 3KB
user15.gif 3KB
brdown.gif 3KB
brup.gif 3KB
bsdown.gif 3KB
user16.gif 3KB
user3.gif 3KB
user5.gif 3KB
bsup.gif 3KB
user10.gif 3KB
user17.gif 2KB
user4.gif 2KB
user8.gif 2KB
user12.gif 2KB
user1.gif 2KB
face3.gif 1KB
face0.gif 1KB
face1.gif 1KB
face4.gif 1KB
face9.gif 1KB
face18.gif 1KB
face2.gif 1KB
face6.gif 1KB
face21.gif 1KB
face12.gif 1KB
face13.gif 1KB
face22.gif 1KB
face5.gif 1KB
face7.gif 1KB
face16.gif 1KB
face15.gif 1KB
face24.gif 1KB
face20.gif 1KB
face11.gif 1KB
face23.gif 1KB
face14.gif 1KB
face19.gif 1KB
face10.gif 1KB
face8.gif 1KB
face17.gif 1KB
pcard.gif 496B
ufn.gif 130B
bfn.gif 127B
ifn.gif 124B
AdminAction.java 22KB
BbsAction.java 16KB
OpDB.java 13KB
LogXAction.java 6KB
BbsForm.java 4KB
UserForm.java 3KB
SearchAction.java 3KB
CreatePage.java 2KB
BoardForm.java 2KB
DB.java 2KB
IndexAction.java 2KB
BbsAnswerForm.java 2KB
OwnAction.java 2KB
AdminAccess.java 2KB
UserAccess.java 1KB
ClassForm.java 1KB
SearchForm.java 1KB
Change.java 799B
MySuperAction.java 617B
ToChinese.java 530B
共 178 条
- 1
- 2
资源评论
我虽横行却不霸道
- 粉丝: 91
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功