JSP中的全文检索
System.out.println(e.toString());
}
}
public class News { //存放结果的类
String content;
String release_time;
String type;
String man_add;
String title;
public String getContent() { return this.content; }
public String getTitle() { return this.title; }
public String getTime() { return this.release_time; }
public String getType() { return this.type; }
public String getMan_add() { return this.man_add; }
}
}
下面的代码是调用的:aftsearch.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.util.*" %>
<%
request.setCharacterEncoding("GB2312");
String keyword=request.getParameter("keyword"); //接收关键字
String trace=getServletContext().getRealPath("/") "xwxx\\\\\\\ews\\\\\\\\";//主体新闻存放路径
NEWS.newsSearch newsSearch=new NEWS.newsSearch();//初始化检索的bean
newsSearch.setFilePath(trace);//设置主体新闻路径
newsSearch.setKeyWord(keyword);//设置关键字
newsSearch.search();//检索
Vector news=newsSearch.getResult();//取到结果
%>
<html>
<head>
<title>新闻搜索</title>
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
文章评论
共有位Admini5网友发表了评论 查看完整内容