📄 manageaction.java
字号:
package com.laoer.bbscs.bbs.action;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.laoer.bbscs.bbs.actionform.*;
import com.laoer.bbscs.bbs.business.*;
import com.laoer.bbscs.sysinfo.*;
import com.laoer.bbscs.util.*;
import com.laoer.bbscs.servlet.*;
import com.laoer.bbscs.db.*;
import org.apache.struts.util.*;
import java.util.*;
public class ManageAction
extends Action {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionErrors errors = new ActionErrors();
BidActionForm form = (BidActionForm) actionForm;
UserSessionCheck myUserSessionCheck = new UserSessionCheck(form.getSid(),
httpServletRequest);
if (!myUserSessionCheck.checkSession(form.getBid())) {
errors.add("error.timeout", new ActionError("error.timeout"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if (myUserSessionCheck.isGuest()) {
errors.add("noguest", new ActionError("error.user.noguest"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
MessageResources messages = getResources(httpServletRequest);
Locale locale = getLocale(httpServletRequest);
httpServletRequest.setAttribute("myUserSessionCheck", myUserSessionCheck);
httpServletRequest.setAttribute("sid", form.getSid());
httpServletRequest.setAttribute("bid", form.getBid());
httpServletRequest.setAttribute("theBoards",
myUserSessionCheck.getTheBoards());
if (form.getAction().equals("m")) {
httpServletRequest.setAttribute("pages", form.getPages());
Pages myPages = PagesFactory.getInstance();
String[] pagessign = {
messages.getMessage(locale, "bbscs.pages.first"),
messages.getMessage(locale, "bbscs.pages.previous"),
messages.getMessage(locale, "bbscs.pages.next"),
messages.getMessage(locale, "bbscs.pages.end")};
myPages.setPagesign(pagessign);
myPages.setStyle(1);
myPages.setPerPageNum(40);
myPages.setPages(Integer.parseInt(form.getPages()));
myPages.setFileName(Sys.getURL() + "manageAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() + "&action=" + form.getAction() +
"&");
ForumInfo aForumInfo = new ForumInfo();
aForumInfo.setBoardID(Long.parseLong(form.getBid()));
Forum myForum = ForumFactory.getInstance();
myForum.setForumInfo(aForumInfo);
myForum.setPages(myPages);
List postlist = myForum.getPostList(null, "PostManagerList");
String pagebreakstr = myForum.getListPageBreak();
httpServletRequest.setAttribute("plistlist", postlist);
httpServletRequest.setAttribute("myPages", myPages);
httpServletRequest.setAttribute("pagebreakstr", pagebreakstr);
errors = null;
form = null;
myUserSessionCheck = null;
messages = null;
locale = null;
myPages = null;
pagessign = null;
aForumInfo = null;
myForum = null;
postlist = null;
pagebreakstr = null;
return actionMapping.findForward("manager");
}
if (form.getAction().equals("w")) {
httpServletRequest.setAttribute("pages", form.getPages());
Pages myPages = PagesFactory.getInstance();
String[] pagessign = {
messages.getMessage(locale, "bbscs.pages.first"),
messages.getMessage(locale, "bbscs.pages.previous"),
messages.getMessage(locale, "bbscs.pages.next"),
messages.getMessage(locale, "bbscs.pages.end")};
myPages.setPagesign(pagessign);
myPages.setStyle(1);
myPages.setPerPageNum(40);
myPages.setPages(Integer.parseInt(form.getPages()));
myPages.setFileName(Sys.getURL() + "manageAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() + "&action=" + form.getAction() +
"&");
ForumInfo aForumInfo = new ForumInfo();
aForumInfo.setBoardID(Long.parseLong(form.getBid()));
Forum myForum = ForumFactory.getInstance();
myForum.setForumInfo(aForumInfo);
myForum.setPages(myPages);
List postlist = myForum.getPostList(null, "wastebox");
String pagebreakstr = myForum.getListPageBreak();
httpServletRequest.setAttribute("plistlist", postlist);
httpServletRequest.setAttribute("myPages", myPages);
httpServletRequest.setAttribute("pagebreakstr", pagebreakstr);
errors = null;
form = null;
myUserSessionCheck = null;
messages = null;
locale = null;
myPages = null;
myPages = null;
pagessign = null;
aForumInfo = null;
myForum = null;
postlist = null;
pagebreakstr = null;
return actionMapping.findForward("wastebox");
}
if (form.getAction().equals("h")) {
BlackUserInfo aBlackUserInfo = new BlackUserInfo();
aBlackUserInfo.setAtBoards(Long.parseLong(form.getBid()));
BlackUser aBlackUser = BlackUserFactory.getInstance();
aBlackUser.setBlackUserInfo(aBlackUserInfo);
List alist = aBlackUser.getBlackUserList(null, "atBoardsList");
httpServletRequest.setAttribute("blackuserlist", alist);
errors = null;
form = null;
myUserSessionCheck = null;
messages = null;
locale = null;
aBlackUserInfo = null;
aBlackUser = null;
alist = null;
return actionMapping.findForward("managerh");
}
return actionMapping.findForward("error");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -