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(null,?,?)";
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 ActionMessa
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件)
资源推荐
资源详情
资源评论
收起资源包目录
java期末大作业 基于Java+JSP实现的BBS论坛源码(含SQL数据库文件) (203个子文件)
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
.classpath 836B
org.eclipse.wst.common.component 439B
org.eclipse.wst.jsdt.ui.superType.container 49B
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
face12.gif 1KB
face21.gif 1KB
face13.gif 1KB
face22.gif 1KB
face5.gif 1KB
face16.gif 1KB
face7.gif 1KB
face24.gif 1KB
face15.gif 1KB
face11.gif 1KB
face20.gif 1KB
face14.gif 1KB
face23.gif 1KB
face10.gif 1KB
face19.gif 1KB
face8.gif 1KB
face17.gif 1KB
pcard.gif 496B
ufn.gif 130B
bfn.gif 127B
ifn.gif 124B
xalan-2.4.0.jar 974KB
freemarker-2.3.8.jar 784KB
struts.jar 537KB
xwork-2.0.4.jar 445KB
mysql-connector-java-3.1.12-bin.jar 436KB
antlr.jar 350KB
standard.jar 343KB
commons-beanutils.jar 184KB
commons-digester.jar 164KB
ognl-2.6.11.jar 164KB
commons-validator.jar 82KB
jakarta-oro.jar 64KB
commons-logging.jar 37KB
commons-fileupload.jar 22KB
jstl.jar 17KB
AdminAction.java 22KB
BbsAction.java 16KB
共 203 条
- 1
- 2
- 3
资源评论
柯晓楠
- 粉丝: 2w+
- 资源: 2847
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功