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

📄 findthreadaction.java

📁 如题ServletJSP.rar 为网络收集的JSP网站源文件
💻 JAVA
字号:
/*
 * XP Forum
 *
 * Copyright (c) 2002-2003 RedSoft Group.  All rights reserved.
 *
 */
package org.redsoft.forum.web;

import java.io.IOException;
import java.sql.SQLException;
import java.util.Collection;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import javax.security.auth.Subject;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;

import org.apache.lucene.queryParser.ParseException;

import org.redsoft.forum.search.ThreadSearcher;
import org.redsoft.forum.search.Thread;
import org.redsoft.forum.ForumConstants;

/**
 * Find threads action
 *
 * @author cinc
 * @version $Id: FindThreadAction.java,v 1.1.1.1 2003/07/08 08:25:17 cinc Exp $
 */
public class FindThreadAction extends Action{


    public ActionForward perform(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws IOException, ServletException {
        ThreadSearcher searcher = ThreadSearcher.getInstance();
        FindThreadForm findThreadForm = (FindThreadForm)form;
        String query = findThreadForm.getQuery();
        String type = findThreadForm.getType();
        Collection threads = null;
        try{
            if (type.equals("title")){
                threads = searcher.findByTitle(query);
            }else if (type.equals("content")){
                threads = searcher.findByContent(query);
            }
        }catch (ParseException e){
            return (mapping.findForward("error"));
        }
        request.setAttribute("threads", threads);
        request.setAttribute("query", query);
        request.setAttribute("threadcount", "" + threads.size());
        //request.setAttribute("offset", new Integer(2));
        return (mapping.findForward("success"));
    }
}//EOC

⌨️ 快捷键说明

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