- 浏览: 134849 次
- 性别:
- 来自: 石家庄
文章分类
最新评论
-
shuzheng5201314:
如果不管这样的错误有影响吗?你这样貌似可行!
Proxool连接池在reload web容器时出现HouseKeeper的空指针异常 -
SpreadDiaries:
...
[转]常见数据库字段类型与java.sql.Types的对应 -
kevinhrw:
<bean
class="org.spri ...
用BeanNameAutoProxyCreator自动创建事务代理 -
hilliate:
第一步,把冰箱门打开第二步,把大象装进去第三步,把冰箱门关上呵 ...
Struts2中实现自定义标签很简单,主要分为3步:
index.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'left.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
26. <a href="searchForm.jsp" target="main">搜索</a><br>
27. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
28. </body>
29.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'left.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
<a href="searchForm.jsp" target="main">搜索</a><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
left.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'left.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
26. <a href="searchForm.jsp" target="main">搜索</a><br>
27. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
28. </body>
29.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'left.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
<a href="searchForm.jsp" target="main">搜索</a><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
top.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'top.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body bgcolor="green">
26. 搜索系统 V 11.0<br>
27. </body>
28.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'top.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor="green">
搜索系统 V 11.0<br>
</body>
</html>
readme.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'readme.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body>
26. 欢迎使用本系统 <br>
27. </body>
28.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'readme.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
欢迎使用本系统 <br>
</body>
</html>
searchForm.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'searchForm.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24. <script type="text/javascript">
25. function check(){
26. if(document.forms[0].key.value==""){
27. alert("关键词不能为空");
28. return false;
29. }
30. return true;
31. }
32. </script>
33. <body>
34. <form action="results.jsp" method="get" onSubmit="return check();">
35. 关键词:<input name=key >
36.
37.
38. <input type=submit value="搜索">
39. </form>
40.
41.
42. <br>
43. </body>
44.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'searchForm.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<script type="text/javascript">
function check(){
if(document.forms[0].key.value==""){
alert("关键词不能为空");
return false;
}
return true;
}
</script>
<body>
<form action="results.jsp" method="get" onSubmit="return check();">
关键词:<input name=key >
<input type=submit value="搜索">
</form>
<br>
</body>
</html>
result.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.
3.<%@ page import="java.io.IOException"%>
4.<%@ page import="org.apache.lucene.document.Document"%>
5.<%@ page import="org.apache.lucene.index.CorruptIndexException"%>
6.<%@ page import="org.apache.lucene.index.Term"%>
7.<%@ page import="org.apache.lucene.search.Hits"%>
8.<%@ page import="org.apache.lucene.search.IndexSearcher"%>
9.<%@ page import="org.apache.lucene.search.Query"%>
10.<%@ page import="org.apache.lucene.search.TermQuery"%>
11.<%@ page import="com.bjsxt.lucene.util.*"%>
12.
13.<%
14.String path = request.getContextPath();
15.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
16.
17.int start = 0;
18.try{
19.start = Integer.parseInt(request.getParameter("start"));
20.}catch(Exception e){}
21.int max = 10;
22.%>
23.
24.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
25.
26.
27.<html>
28. <head>
29. <base href="<%=basePath%>">
30.
31. <title>My JSP 'results.jsp' starting page</title>
32.
33. <meta http-equiv="pragma" content="no-cache">
34. <meta http-equiv="cache-control" content="no-cache">
35. <meta http-equiv="expires" content="0">
36. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
37. <meta http-equiv="description" content="This is my page">
38.
39. <link rel="stylesheet" type="text/css" href="styles.css">
40.
41.
42. </head>
43. <script type="text/javascript">
44. function check(){
45. if(document.forms[0].key.value==""){
46. alert("关键词不能为空");
47. return false;
48. }
49. return true;
50. }
51. </script>
52. <body>
53.
54.<%
55. String index = "D:\\share\\0400_Servlet_JSP\\soft\\apache-tomcat-5.5.17\\apache-tomcat-5.5.17\\index_cn";
56. IndexSearcher searcher=null;
57. searcher = new IndexSearcher(index);
58. Query query = new TermQuery(new Term("title",request.getParameter("key")));
59. Hits hits = searcher.search(query);
60. System.out.println(hits.length());
61. if(hits.length()>0){
62.
63. %>
64. <form action="results.jsp" method="get" name=searchForm onSubmit="return check()">
65. 关键词:<input name=key value="<%=request.getParameter("key") %>">
66. <input name=start value="<%=start%>">
67. <input type=submit value="搜索">
68. </form>
69. 一共找到了<%=hits.length() %>条结果
70. <div id=gridData>
71. <table border=0 cellpadding="3" cellspacing="1">
72. <tr>
73. <td>序号</td>
74. <td>标题</td>
75. <!-- <td>摘要</td> -->
76. </tr>
77. <%
78.
79. for (int i = start; i < start+max; i++) {
80. if(i>=hits.length()){
81. break;
82. }
83. Document doc = hits.doc(i);
84. String _title = doc.get("title");
85. String _summary = doc.get("summary");
86. String _path = doc.get("path");
87. //D:\share\0100_J2SE\soft\html_zh_CN\html\zh_CN\api\java\lang\String.html
88. //http://127.0.0.1/api/java/lang/String.html
89.
90.
91. _path = _path.replaceAll("D:\\\\share\\\\0100_J2SE\\\\soft\\\\html_zh_CN\\\\html\\\\zh_CN\\\\","");
92. _path = _path.replace('\\','/');
93. _path = "http://127.0.0.1/"+_path;
94. System.out.println(_path);
95.
96.%>
97. <tr>
98. <td><%=i+1 %></td>
99. <td><a href="<%=_path %>"><%=_title %></a></td>
100. <!-- <td><%=com.bjsxt.lucene.util.DataFilter.getHTML(_summary)%></td> -->
101. </tr>
102.
103.<% }
104. searcher.close();
105.
106. %>
107.
108.
109.
110. </table>
111.<a href="javascript:first();">首页</a>
112.<%if(start-max>=0){ %>
113. <a href="javascript:previous();">上一页</a>
114.<%}else{ %>
115. 上一页
116.<%} %>
117.<%if(start+max<hits.length()){ %>
118. <a href="javascript:next();">下一页</a>
119.<%}else{ %>
120. 下一页
121.<%} %>
122.<a href="javascript:last();">尾页</a>
123.</div>
124.
125.<script type="text/javascript">
126.function first(){
127. searchForm.start.value=0;
128. searchForm.submit();
129.}
130.function previous(){
131. searchForm.start.value=<%=start-max%>;
132. searchForm.submit();
133.}
134.function next(){
135. searchForm.start.value=<%=start+max%>;
136. searchForm.submit();
137.}
138.function last(){
139. searchForm.start.value=<%=hits.length()/max*max%>;
140. searchForm.submit();
141.}
142.
143.</script>
144.<%}else{ %>
145.
146. 对不起没找到结果,请重新设定搜索条件<a href=javascript:history.back()>返回</a>
147.
148.<%} %>
149. <br>
150. </body>
151.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ page import="java.io.IOException"%>
<%@ page import="org.apache.lucene.document.Document"%>
<%@ page import="org.apache.lucene.index.CorruptIndexException"%>
<%@ page import="org.apache.lucene.index.Term"%>
<%@ page import="org.apache.lucene.search.Hits"%>
<%@ page import="org.apache.lucene.search.IndexSearcher"%>
<%@ page import="org.apache.lucene.search.Query"%>
<%@ page import="org.apache.lucene.search.TermQuery"%>
<%@ page import="com.bjsxt.lucene.util.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
int start = 0;
try{
start = Integer.parseInt(request.getParameter("start"));
}catch(Exception e){}
int max = 10;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'results.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<script type="text/javascript">
function check(){
if(document.forms[0].key.value==""){
alert("关键词不能为空");
return false;
}
return true;
}
</script>
<body>
<%
String index = "D:\\share\\0400_Servlet_JSP\\soft\\apache-tomcat-5.5.17\\apache-tomcat-5.5.17\\index_cn";
IndexSearcher searcher=null;
searcher = new IndexSearcher(index);
Query query = new TermQuery(new Term("title",request.getParameter("key")));
Hits hits = searcher.search(query);
System.out.println(hits.length());
if(hits.length()>0){
%>
<form action="results.jsp" method="get" name=searchForm onSubmit="return check()">
关键词:<input name=key value="<%=request.getParameter("key") %>">
<input name=start value="<%=start%>">
<input type=submit value="搜索">
</form>
一共找到了<%=hits.length() %>条结果
<div id=gridData>
<table border=0 cellpadding="3" cellspacing="1">
<tr>
<td>序号</td>
<td>标题</td>
<!-- <td>摘要</td> -->
</tr>
<%
for (int i = start; i < start+max; i++) {
if(i>=hits.length()){
break;
}
Document doc = hits.doc(i);
String _title = doc.get("title");
String _summary = doc.get("summary");
String _path = doc.get("path");
//D:\share\0100_J2SE\soft\html_zh_CN\html\zh_CN\api\java\lang\String.html
//http://127.0.0.1/api/java/lang/String.html
_path = _path.replaceAll("D:\\\\share\\\\0100_J2SE\\\\soft\\\\html_zh_CN\\\\html\\\\zh_CN\\\\","");
_path = _path.replace('\\','/');
_path = "http://127.0.0.1/"+_path;
System.out.println(_path);
%>
<tr>
<td><%=i+1 %></td>
<td><a href="<%=_path %>"><%=_title %></a></td>
<!-- <td><%=com.bjsxt.lucene.util.DataFilter.getHTML(_summary)%></td> -->
</tr>
<% }
searcher.close();
%>
</table>
<a href="javascript:first();">首页</a>
<%if(start-max>=0){ %>
<a href="javascript:previous();">上一页</a>
<%}else{ %>
上一页
<%} %>
<%if(start+max<hits.length()){ %>
<a href="javascript:next();">下一页</a>
<%}else{ %>
下一页
<%} %>
<a href="javascript:last();">尾页</a>
</div>
<script type="text/javascript">
function first(){
searchForm.start.value=0;
searchForm.submit();
}
function previous(){
searchForm.start.value=<%=start-max%>;
searchForm.submit();
}
function next(){
searchForm.start.value=<%=start+max%>;
searchForm.submit();
}
function last(){
searchForm.start.value=<%=hits.length()/max*max%>;
searchForm.submit();
}
</script>
<%}else{ %>
对不起没找到结果,请重新设定搜索条件<a href=javascript:history.back()>返回</a>
<%} %>
<br>
</body>
</html>
styles.css
Java代码
1.BODY{
2. FONT-SIZE: 9pt;
3. line-height: 150%;
4. margin-top:10px;
5. margin-bottom:0px;
6. margin-left:10px;
7. margin- right:0px;
8. scrollbar-face-color: #f6f6f6;
9. scrollbar-highlight-color: #ffffff;
10. scrollbar-shadow-color: #cccccc;
11. scrollbar-3dlight-color: #cccccc;
12. scrollbar-arrow-color: #330000;
13. scrollbar-track-color: #f6f6f6;
14. scrollbar-darkshadow-color: #ffffff;
15.}
16.input{
17. BORDER-TOP-WIDTH: 1px;
18. PADDING-RIGHT: 1px;
19. PADDING-LEFT: 1px;
20. BORDER-LEFT-WIDTH: 1px;
21. FONT-SIZE: 9pt;
22. BORDER-LEFT-COLOR: #cccccc;
23. BORDER-BOTTOM-WIDTH: 1px;
24. BORDER-BOTTOM-COLOR: #cccccc;
25. PADDING-BOTTOM: 1px;
26. BORDER-TOP-COLOR: #cccccc;
27. PADDING-TOP: 1px;
28. BORDER-RIGHT-WIDTH: 1px;
29. BORDER-RIGHT-COLOR: #cccccc;
30. font-family: "????", "Arial", "Helvetica", "sans-serif";
31. font-size:12px;
32.}
33.
34.a:link { FONT-SIZE: 12px;color:#4020a0;text-decoration:none}
35.a:visited { FONT-SIZE: 12px;color:#4020a0;text-decoration:none}
36.a:hover { FONT-SIZE: 12px;color:#FF0000; text-decoration:underline; }
37.
38.td {
39. font-size: 12px;
40.}
41.
42.
43.#gridData{
44. margin-left:2px;
45. margin-top:2px;
46. padding-top:5px;
47. padding-bottom:5px;
48. background-color:#E2F0FE;
49. width: 100%;
50. align:center;
51.}
52.#gridData table {
53. background-color:#7C9CCB;
54. align:center;
55. margin: 5px;
56. width: 98%;
57.}
58.#gridData table tr{
59. font-size: 12px;
60. background-color:#F2F8FE;
61.
62.}
63.#gridData table td{
64. font-size: 12px;
65. AAAAAbackground-color:#F2F8FE;
66.
67.}
68.
69..listtable{
70. WIDTH: 95%;
71.}
72..listtable td{
73. border-top: 1px solid #ffffff;
74. border-bottom: 1px solid #dddddd;
75.
76.}
77..listtabletitle{
78. color:"#4020a0";
79. font-weight:bold;
80. FONT-SIZE: 12px;
81.}
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'left.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
26. <a href="searchForm.jsp" target="main">搜索</a><br>
27. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
28. </body>
29.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'left.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
<a href="searchForm.jsp" target="main">搜索</a><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
left.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'left.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
26. <a href="searchForm.jsp" target="main">搜索</a><br>
27. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
28. </body>
29.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'left.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor=f1f1f1 style="border-right:#000000 1px solid">
<a href="searchForm.jsp" target="main">搜索</a><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
top.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'top.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body bgcolor="green">
26. 搜索系统 V 11.0<br>
27. </body>
28.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'top.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body bgcolor="green">
搜索系统 V 11.0<br>
</body>
</html>
readme.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'readme.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24.
25. <body>
26. 欢迎使用本系统 <br>
27. </body>
28.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'readme.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
欢迎使用本系统 <br>
</body>
</html>
searchForm.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.<%
3.String path = request.getContextPath();
4.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5.%>
6.
7.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8.<html>
9. <head>
10. <base href="<%=basePath%>">
11.
12. <title>My JSP 'searchForm.jsp' starting page</title>
13.
14. <meta http-equiv="pragma" content="no-cache">
15. <meta http-equiv="cache-control" content="no-cache">
16. <meta http-equiv="expires" content="0">
17. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18. <meta http-equiv="description" content="This is my page">
19. <!--
20. <link rel="stylesheet" type="text/css" href="styles.css">
21. -->
22.
23. </head>
24. <script type="text/javascript">
25. function check(){
26. if(document.forms[0].key.value==""){
27. alert("关键词不能为空");
28. return false;
29. }
30. return true;
31. }
32. </script>
33. <body>
34. <form action="results.jsp" method="get" onSubmit="return check();">
35. 关键词:<input name=key >
36.
37.
38. <input type=submit value="搜索">
39. </form>
40.
41.
42. <br>
43. </body>
44.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'searchForm.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<script type="text/javascript">
function check(){
if(document.forms[0].key.value==""){
alert("关键词不能为空");
return false;
}
return true;
}
</script>
<body>
<form action="results.jsp" method="get" onSubmit="return check();">
关键词:<input name=key >
<input type=submit value="搜索">
</form>
<br>
</body>
</html>
result.jsp
Java代码
1.<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
2.
3.<%@ page import="java.io.IOException"%>
4.<%@ page import="org.apache.lucene.document.Document"%>
5.<%@ page import="org.apache.lucene.index.CorruptIndexException"%>
6.<%@ page import="org.apache.lucene.index.Term"%>
7.<%@ page import="org.apache.lucene.search.Hits"%>
8.<%@ page import="org.apache.lucene.search.IndexSearcher"%>
9.<%@ page import="org.apache.lucene.search.Query"%>
10.<%@ page import="org.apache.lucene.search.TermQuery"%>
11.<%@ page import="com.bjsxt.lucene.util.*"%>
12.
13.<%
14.String path = request.getContextPath();
15.String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
16.
17.int start = 0;
18.try{
19.start = Integer.parseInt(request.getParameter("start"));
20.}catch(Exception e){}
21.int max = 10;
22.%>
23.
24.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
25.
26.
27.<html>
28. <head>
29. <base href="<%=basePath%>">
30.
31. <title>My JSP 'results.jsp' starting page</title>
32.
33. <meta http-equiv="pragma" content="no-cache">
34. <meta http-equiv="cache-control" content="no-cache">
35. <meta http-equiv="expires" content="0">
36. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
37. <meta http-equiv="description" content="This is my page">
38.
39. <link rel="stylesheet" type="text/css" href="styles.css">
40.
41.
42. </head>
43. <script type="text/javascript">
44. function check(){
45. if(document.forms[0].key.value==""){
46. alert("关键词不能为空");
47. return false;
48. }
49. return true;
50. }
51. </script>
52. <body>
53.
54.<%
55. String index = "D:\\share\\0400_Servlet_JSP\\soft\\apache-tomcat-5.5.17\\apache-tomcat-5.5.17\\index_cn";
56. IndexSearcher searcher=null;
57. searcher = new IndexSearcher(index);
58. Query query = new TermQuery(new Term("title",request.getParameter("key")));
59. Hits hits = searcher.search(query);
60. System.out.println(hits.length());
61. if(hits.length()>0){
62.
63. %>
64. <form action="results.jsp" method="get" name=searchForm onSubmit="return check()">
65. 关键词:<input name=key value="<%=request.getParameter("key") %>">
66. <input name=start value="<%=start%>">
67. <input type=submit value="搜索">
68. </form>
69. 一共找到了<%=hits.length() %>条结果
70. <div id=gridData>
71. <table border=0 cellpadding="3" cellspacing="1">
72. <tr>
73. <td>序号</td>
74. <td>标题</td>
75. <!-- <td>摘要</td> -->
76. </tr>
77. <%
78.
79. for (int i = start; i < start+max; i++) {
80. if(i>=hits.length()){
81. break;
82. }
83. Document doc = hits.doc(i);
84. String _title = doc.get("title");
85. String _summary = doc.get("summary");
86. String _path = doc.get("path");
87. //D:\share\0100_J2SE\soft\html_zh_CN\html\zh_CN\api\java\lang\String.html
88. //http://127.0.0.1/api/java/lang/String.html
89.
90.
91. _path = _path.replaceAll("D:\\\\share\\\\0100_J2SE\\\\soft\\\\html_zh_CN\\\\html\\\\zh_CN\\\\","");
92. _path = _path.replace('\\','/');
93. _path = "http://127.0.0.1/"+_path;
94. System.out.println(_path);
95.
96.%>
97. <tr>
98. <td><%=i+1 %></td>
99. <td><a href="<%=_path %>"><%=_title %></a></td>
100. <!-- <td><%=com.bjsxt.lucene.util.DataFilter.getHTML(_summary)%></td> -->
101. </tr>
102.
103.<% }
104. searcher.close();
105.
106. %>
107.
108.
109.
110. </table>
111.<a href="javascript:first();">首页</a>
112.<%if(start-max>=0){ %>
113. <a href="javascript:previous();">上一页</a>
114.<%}else{ %>
115. 上一页
116.<%} %>
117.<%if(start+max<hits.length()){ %>
118. <a href="javascript:next();">下一页</a>
119.<%}else{ %>
120. 下一页
121.<%} %>
122.<a href="javascript:last();">尾页</a>
123.</div>
124.
125.<script type="text/javascript">
126.function first(){
127. searchForm.start.value=0;
128. searchForm.submit();
129.}
130.function previous(){
131. searchForm.start.value=<%=start-max%>;
132. searchForm.submit();
133.}
134.function next(){
135. searchForm.start.value=<%=start+max%>;
136. searchForm.submit();
137.}
138.function last(){
139. searchForm.start.value=<%=hits.length()/max*max%>;
140. searchForm.submit();
141.}
142.
143.</script>
144.<%}else{ %>
145.
146. 对不起没找到结果,请重新设定搜索条件<a href=javascript:history.back()>返回</a>
147.
148.<%} %>
149. <br>
150. </body>
151.</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ page import="java.io.IOException"%>
<%@ page import="org.apache.lucene.document.Document"%>
<%@ page import="org.apache.lucene.index.CorruptIndexException"%>
<%@ page import="org.apache.lucene.index.Term"%>
<%@ page import="org.apache.lucene.search.Hits"%>
<%@ page import="org.apache.lucene.search.IndexSearcher"%>
<%@ page import="org.apache.lucene.search.Query"%>
<%@ page import="org.apache.lucene.search.TermQuery"%>
<%@ page import="com.bjsxt.lucene.util.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
int start = 0;
try{
start = Integer.parseInt(request.getParameter("start"));
}catch(Exception e){}
int max = 10;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'results.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<script type="text/javascript">
function check(){
if(document.forms[0].key.value==""){
alert("关键词不能为空");
return false;
}
return true;
}
</script>
<body>
<%
String index = "D:\\share\\0400_Servlet_JSP\\soft\\apache-tomcat-5.5.17\\apache-tomcat-5.5.17\\index_cn";
IndexSearcher searcher=null;
searcher = new IndexSearcher(index);
Query query = new TermQuery(new Term("title",request.getParameter("key")));
Hits hits = searcher.search(query);
System.out.println(hits.length());
if(hits.length()>0){
%>
<form action="results.jsp" method="get" name=searchForm onSubmit="return check()">
关键词:<input name=key value="<%=request.getParameter("key") %>">
<input name=start value="<%=start%>">
<input type=submit value="搜索">
</form>
一共找到了<%=hits.length() %>条结果
<div id=gridData>
<table border=0 cellpadding="3" cellspacing="1">
<tr>
<td>序号</td>
<td>标题</td>
<!-- <td>摘要</td> -->
</tr>
<%
for (int i = start; i < start+max; i++) {
if(i>=hits.length()){
break;
}
Document doc = hits.doc(i);
String _title = doc.get("title");
String _summary = doc.get("summary");
String _path = doc.get("path");
//D:\share\0100_J2SE\soft\html_zh_CN\html\zh_CN\api\java\lang\String.html
//http://127.0.0.1/api/java/lang/String.html
_path = _path.replaceAll("D:\\\\share\\\\0100_J2SE\\\\soft\\\\html_zh_CN\\\\html\\\\zh_CN\\\\","");
_path = _path.replace('\\','/');
_path = "http://127.0.0.1/"+_path;
System.out.println(_path);
%>
<tr>
<td><%=i+1 %></td>
<td><a href="<%=_path %>"><%=_title %></a></td>
<!-- <td><%=com.bjsxt.lucene.util.DataFilter.getHTML(_summary)%></td> -->
</tr>
<% }
searcher.close();
%>
</table>
<a href="javascript:first();">首页</a>
<%if(start-max>=0){ %>
<a href="javascript:previous();">上一页</a>
<%}else{ %>
上一页
<%} %>
<%if(start+max<hits.length()){ %>
<a href="javascript:next();">下一页</a>
<%}else{ %>
下一页
<%} %>
<a href="javascript:last();">尾页</a>
</div>
<script type="text/javascript">
function first(){
searchForm.start.value=0;
searchForm.submit();
}
function previous(){
searchForm.start.value=<%=start-max%>;
searchForm.submit();
}
function next(){
searchForm.start.value=<%=start+max%>;
searchForm.submit();
}
function last(){
searchForm.start.value=<%=hits.length()/max*max%>;
searchForm.submit();
}
</script>
<%}else{ %>
对不起没找到结果,请重新设定搜索条件<a href=javascript:history.back()>返回</a>
<%} %>
<br>
</body>
</html>
styles.css
Java代码
1.BODY{
2. FONT-SIZE: 9pt;
3. line-height: 150%;
4. margin-top:10px;
5. margin-bottom:0px;
6. margin-left:10px;
7. margin- right:0px;
8. scrollbar-face-color: #f6f6f6;
9. scrollbar-highlight-color: #ffffff;
10. scrollbar-shadow-color: #cccccc;
11. scrollbar-3dlight-color: #cccccc;
12. scrollbar-arrow-color: #330000;
13. scrollbar-track-color: #f6f6f6;
14. scrollbar-darkshadow-color: #ffffff;
15.}
16.input{
17. BORDER-TOP-WIDTH: 1px;
18. PADDING-RIGHT: 1px;
19. PADDING-LEFT: 1px;
20. BORDER-LEFT-WIDTH: 1px;
21. FONT-SIZE: 9pt;
22. BORDER-LEFT-COLOR: #cccccc;
23. BORDER-BOTTOM-WIDTH: 1px;
24. BORDER-BOTTOM-COLOR: #cccccc;
25. PADDING-BOTTOM: 1px;
26. BORDER-TOP-COLOR: #cccccc;
27. PADDING-TOP: 1px;
28. BORDER-RIGHT-WIDTH: 1px;
29. BORDER-RIGHT-COLOR: #cccccc;
30. font-family: "????", "Arial", "Helvetica", "sans-serif";
31. font-size:12px;
32.}
33.
34.a:link { FONT-SIZE: 12px;color:#4020a0;text-decoration:none}
35.a:visited { FONT-SIZE: 12px;color:#4020a0;text-decoration:none}
36.a:hover { FONT-SIZE: 12px;color:#FF0000; text-decoration:underline; }
37.
38.td {
39. font-size: 12px;
40.}
41.
42.
43.#gridData{
44. margin-left:2px;
45. margin-top:2px;
46. padding-top:5px;
47. padding-bottom:5px;
48. background-color:#E2F0FE;
49. width: 100%;
50. align:center;
51.}
52.#gridData table {
53. background-color:#7C9CCB;
54. align:center;
55. margin: 5px;
56. width: 98%;
57.}
58.#gridData table tr{
59. font-size: 12px;
60. background-color:#F2F8FE;
61.
62.}
63.#gridData table td{
64. font-size: 12px;
65. AAAAAbackground-color:#F2F8FE;
66.
67.}
68.
69..listtable{
70. WIDTH: 95%;
71.}
72..listtable td{
73. border-top: 1px solid #ffffff;
74. border-bottom: 1px solid #dddddd;
75.
76.}
77..listtabletitle{
78. color:"#4020a0";
79. font-weight:bold;
80. FONT-SIZE: 12px;
81.}
- Lucene项目的jsp.rar (81 KB)
- 下载次数: 36
发表评论
-
truelicense使用手册
2015-04-25 09:47 39201.生成truelicense的maven项目 mvn a ... -
Java实现ftp上传文件、文件夹
2012-04-06 11:06 841import java.io.File; import ... -
Lucene入门级笔记六 -- 优化 .
2011-10-24 22:54 0Lucene 优化 1. 让程序中只有一个 Inde ... -
Lucene入门级笔记五 -- 分词器,使用中文分词器,扩展词库,停用词 .
2011-10-24 22:53 14071. 常见的中文分词器有 ... -
Lucene(全文检索技术)入门级笔记整之一——第一个Lucene程序 .
2011-10-24 22:50 1242Lucene(全文检索技术)入门级笔记整之一——第一个Lu ... -
Lucene入门级笔记二 -- 索引库的CRUD API 演示 .
2011-10-24 22:44 1081Lucene 对索引库的增删改查操作的 API 演示 没什么 ... -
Lucene入门级笔记三 -- 给关键词添加高亮效果
2011-10-24 22:43 17231. 使用高亮器。 2. ... -
Lucene入门级笔记四 -- 对检索结果排序 .
2011-10-24 22:40 1553对检索结果排序 1. 某些场合需要我们自定义搜索结果的 ... -
java获取各种日期
2011-07-14 16:47 828package com.cjy.test; impo ... -
tomcat无法运行两个struts2项目。解决方式
2011-06-15 14:22 1028提示异常: 严重: Exception starting f ... -
APACHE 2.2.9+TOMCAT6.0.18配置负载均衡
2010-10-21 23:14 1462目标: 使用 apache 和 tomcat 配置一个可以应 ... -
Request用法
2010-09-08 11:13 1182Request [JSP] JSP中的隐藏对象 -- ... -
div错位/解决IE6、IE7、IE8样式不兼容问题
2010-01-13 10:07 2299IE6里DIV错位的问题 ... -
主题:J2EE常用工具类汇总
2009-10-18 18:24 853J2EE常用工具类汇总 J2EE ... -
dreamweaver cs4 许可证过期的解决办法
2009-09-24 13:43 1854dreamweaver cs4 许可证过期的解决办法 200 ... -
lucene四种索引方式详解
2009-09-16 21:45 11711。今天研究了一下lucene,对于初学者来说,有一个地方以前 ... -
时间处理类
2009-07-24 10:14 769/** * 时间处理类 */ ... -
apache POI 读取 Word
2009-07-24 10:13 1314import java.io.File; import ... -
apache POI 读取 Excel
2009-07-24 10:12 1225import java.io.File; import ja ... -
自动得到汉语拼音
2009-07-24 10:11 961import java.util.Iterator; imp ...
相关推荐
在这个项目中,Lucene被结合了JSP(JavaServer Pages)和JAVA技术,创建了一个功能完善的搜索引擎。 **1. Lucene基础知识** Lucene的核心功能包括文本分析、索引构建和查询解析。它首先对输入的文档进行分词,然后...
本项目着重讲解如何利用Lucene 5.5版本来实现会议期刊的检索功能,并结合JSP技术进行展示。以下是对该项目中涉及的技术点的详细解释: 1. **Lucene核心概念**: - **索引**: Lucene通过索引非结构化文本数据,使...
本项目是一个基于JSP技术,结合Lucene搜索引擎的学校实训项目——公交搜索系统。这个系统主要目的是让学生在实践中掌握Web开发的基本技能,了解并运用Java、HTML和JSP进行动态网页设计,同时学习如何利用Lucene进行...
本项目基于Java技术栈,结合JSP、Servlet、JDBC以及Lucene库,构建了一个功能完备的搜索引擎系统。 **JSP(JavaServer Pages)** JSP是Java平台上的动态网页技术,它允许开发人员在HTML或XML文档中嵌入Java代码,...
**Lucene在Web项目中的应用** Lucene是一个高性能、全文本搜索库,由Apache软件基金会开发,它提供了完整的搜索解决方案,包括索引构建、搜索功能以及分词处理。在Java Web项目中,Lucene能够帮助开发者实现高效、...
对学习lucene开发的人员来说这个项目非常有价值 值得参考">项目的页面都存在WebRoot WEB INF jsp下 网上搜索博客园网页的地址 输入到相应搜索框 该项目可以自动对博客园网站中的文章 项目中限制了文章数量 建立...
本项目是一个基于JavaWeb、JSP和Lucene技术构建的公交搜索系统,旨在为用户提供便捷的公共交通查询服务。这个系统的核心功能是通过搜索引擎技术Lucene来快速检索公交线路,结合JavaWeb和JSP的技术实现用户界面的动态...
在这个压缩包中,你可能会找到如`index.jsp`(前端页面)、`search.java`(后端处理搜索请求的Java类)、`Analyzer配置`(用于定制分词规则)、`索引文件`(由Lucene创建的存储搜索数据的文件)等组件。 总的来说,...
描述中提到的“导入这几个包再使用”,指的是在Java项目中,我们需要将这些jar包添加到项目的类路径(Classpath)中,以便编译器和运行时环境能够找到并加载Lucene的相关类。这通常是通过IDE(如Eclipse或IntelliJ ...
在Spring Boot项目中集成Lucene,我们需要以下几个步骤: 1. **添加依赖**:在`pom.xml`文件中引入Lucene和Spring Data JPA(如果需要数据库支持)的依赖。 2. **创建索引**:定义一个`IndexWriter`,用于将数据...
- `results.jsp`:这可能是展示搜索结果的 JSP 页面,用于渲染从 Lucene 搜索得到的数据。 - `index.jsp`:可能是一个网页的首页,可能包含搜索框等元素,用户可以输入查询请求。 - `configuration.jsp`:配置...
在我们的项目中,Struts2被用来处理用户请求,管理页面流程,以及与后台Lucene索引的交互。 **文件上传与下载** 在系统中,用户可以上传文件,这些文件随后会被索引以便进行全文检索。文件上传通常涉及HTTP协议,...
总结来说,这个基于Lucene的小型搜索引擎项目涵盖了网络爬虫、数据处理、全文搜索引擎和前端开发等多个环节。通过Heritrix爬取数据,利用Lucene建立高效索引,JSP实现交互界面,形成了一套完整的搜索引擎系统。这样...
《基于JSP与Lucene的公交搜索...这个实例不仅展示了JSP与Lucene的结合应用,也为其他类似项目的开发提供了参考和借鉴。学习并理解这一系统,对于提升JavaWeb开发技能,尤其是搜索引擎技术的理解,有着重要的实践意义。
下载完成后,根据所使用的开发环境(如JBuilder或JSP)配置类路径,确保Lucene库被正确引入。 3. Lucene 范例(Demo) Lucene提供了多种示例程序,帮助初学者快速上手。这些示例包括普通文件、HTML文件和XML文件的...
Lucene被广泛应用于各种需要全文检索的项目中,如网站、文档管理、内容管理系统等。本压缩包包含了Lucene的一些学习实例和相关文档,旨在帮助对Lucene感兴趣的开发者更好地理解和掌握其用法。 首先,我们来看看...
【标题】:“基于Lucene的Web站内信息搜索系统” 【描述】:Lucene是一个高性能、全文本搜索引擎库...而“基于Lucene的Web站内信息搜索系统”可能是一个示例项目,包含了完整的代码和配置文件,可供开发者参考和学习。
这里可能会使用Lucene的Highlighter对匹配片段进行处理,然后在jsp页面上显示。 4. **配置文件**:Struts2的配置文件(struts.xml)定义了Action的映射和结果类型,以及可能的拦截器链,确保搜索请求被正确地路由和...