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

📄 indexaction.java~7~

📁 全文搜索源码,基于开源项目Lucene编写,开发语言为JAVA,本程序做为LUCENE的示例DEMO
💻 JAVA~7~
字号:
package com.ht.gis.action;import com.ht.gis.form.IndexForm;import org.apache.struts.action.*;import javax.servlet.http.*;import javax.servlet.ServletContext;import com.ht.gis.service.*;import com.ht.gis.search.*;public class IndexAction extends Action {  private static Log log = LogFactory.getLog("WebGIS");  public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {    try{      //=============== 取表单数据 =======================      IndexForm indexForm = (IndexForm)actionForm;      String order = indexForm.getOrder();      //=============== 对数据库进行全文索引 ================      HttpSession httpSession = httpServletRequest.getSession(false);      ServletContext servContext = httpSession.getServletContext();      Indexer indexer = (Indexer)servContext.getAttribute("Indexer");      String indexResult = indexer.setIndex();      //=============== 返回结果数据表单 ==================      httpServletResponse.getWriter().println(responseXML);      return null;    }catch(Exception e){      log.error(e);      ActionErrors errors = new ActionErrors();      errors.add("username", new ActionError("login.defeat"));      this.saveErrors(httpServletRequest, errors);      return actionMapping.findForward("fault");    }  }}

⌨️ 快捷键说明

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