📄 findthreadaction.java
字号:
/* * XP Forum * * Copyright (c) 2002-2003 RedSoft Group. All rights reserved. * */package org.redsoft.forum.web;import org.apache.lucene.queryParser.ParseException;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.redsoft.forum.search.ThreadSearcher;import javax.servlet.ServletException;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import java.io.IOException;import java.util.Collection;/** * Find threads action * * @author cinc * @version $Id: FindThreadAction.java,v 1.1.1.1 2004/02/04 03:52:13 mustang Exp $ */public class FindThreadAction extends Action{ public ActionForward execute(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")); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -