📄 readaction.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 ReadAction
extends Action {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionErrors errors = new ActionErrors();
ReadActionForm form = (ReadActionForm) 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");
}
MessageResources messages = getResources(httpServletRequest);
Locale locale = getLocale(httpServletRequest);
String headadv = ShowMsg.getHeadAdv(messages, locale, form.getSid(),
myUserSessionCheck);
httpServletRequest.setAttribute("headadv", headadv);
httpServletRequest.setAttribute("myUserSessionCheck", myUserSessionCheck);
httpServletRequest.setAttribute("sid", form.getSid());
httpServletRequest.setAttribute("bid", form.getBid());
httpServletRequest.setAttribute("pages", form.getPages());
httpServletRequest.setAttribute("inpages", form.getInpages());
httpServletRequest.setAttribute("recid", form.getRecid());
httpServletRequest.setAttribute("theBoards",
myUserSessionCheck.getTheBoards());
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.setPerPageNum(Sys.SYSINFO.POSTPERNUM);
myPages.setPages(Integer.parseInt(form.getInpages()));
myPages.setStyle(2);
myPages.setFileName(Sys.getURL() + "readAction.do?sid=" + form.getSid() +
"&bid=" + form.getBid() + "&recid=" + form.getRecid() +
"&pages=" + form.getPages() + "&");
ForumInfo aForumInfo = new ForumInfo();
aForumInfo.setBoardID(Long.parseLong(form.getBid()));
aForumInfo.setID(Long.parseLong(form.getRecid()));
aForumInfo.setID2(Long.parseLong(form.getRecid()));
Forum myForum = ForumFactory.getInstance();
myForum.setForumInfo(aForumInfo);
if (form.getInpages().equals("1")) {
myForum.updatePost(null, "click");
}
myForum.setPages(myPages);
List postlist = myForum.getPostList(null, "PostTopicList");
if (postlist.size() == 0) {
errors.add("getpost", new ActionError("error.post.getpost"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
String pagebreakstr = myForum.getListPageBreak();
httpServletRequest.setAttribute("plistlist", postlist);
httpServletRequest.setAttribute("myPages", myPages);
httpServletRequest.setAttribute("pagebreakstr", pagebreakstr);
return actionMapping.findForward("showdoc");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -