⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchpostaction.java

📁 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar
💻 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.*;
import java.net.*;

public class SearchPostAction
    extends Action {

  public ActionForward execute(ActionMapping actionMapping,
                               ActionForm actionForm,
                               HttpServletRequest httpServletRequest,
                               HttpServletResponse httpServletResponse) {
    ActionErrors errors = new ActionErrors();
    SearchPostActionForm form = (SearchPostActionForm)
        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("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.setStyle(1);
    myPages.setPerPageNum(Sys.SYSINFO.FORUMPERNUM);
    myPages.setPages(Integer.parseInt(form.getPages()));
    String sc = "";
    String st = "";
    try {
      sc = URLEncoder.encode(form.getSearchcon(), "UTF-8");
      st = URLEncoder.encode(form.getSearchtext(), "UTF-8");
    }
    catch (Exception e) {

    }
    myPages.setFileName(Sys.getURL() + "searchPostAction.do?sid=" + form.getSid() +
                        "&bid=" + form.getBid() + "&searchcon=" + sc +
                        "&searchtext=" + st + "&");
    ForumInfo aForumInfo = new ForumInfo();
    aForumInfo.setBoardID(Long.parseLong(form.getBid()));
    Forum myForum = ForumFactory.getInstance();
    myForum.setForumInfo(aForumInfo);
    myForum.setPages(myPages);
    myForum.setSearchCon(form.getSearchcon());
    myForum.setSearchText(form.getSearchtext());
    List postlist = myForum.getPostList(null, "search");
    String pagebreakstr = myForum.getListPageBreak();
    httpServletRequest.setAttribute("plistlist", postlist);
    httpServletRequest.setAttribute("myPages", myPages);
    httpServletRequest.setAttribute("pagebreakstr", pagebreakstr);
    return actionMapping.findForward("searchpost");

  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -