home | career | drupal | java | mac | mysql | perl | scala | uml | unix  
<td><%=doc.get("location")%> <td class="resultNum"><%=doc.get("salary")%>,000 <td><%=doc.get("description")%> </tr> <% } %> </table> <% }//end if has results %> </body> </html>

Other Lucene examples (source code examples)

Here is a short list of links related to this Lucene index.jsp source code file:

Lucene example source code file (index.jsp)

This example Lucene source code file (index.jsp) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lucene tags/keywords

any, contract, contract, description, document, license, license, permanent, permanent, salary, see, string, string, you

The Lucene index.jsp source code

<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
 
        http://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
import="org.apache.lucene.search.*,org.apache.lucene.document.*"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 	<link rel="stylesheet" type="text/css" href="stylesheet.css">
	<title>XML Query Parser demo
</head>
<body>
<h1>Job Search
<%
			// Load form variables
			String description=request.getParameter("description");
			String type=request.getParameter("type");
			String salaryRange=request.getParameter("salaryRange"); 
%>
<form method="POST" action="FormBasedXmlQueryDemo">
<table >
	<tr>
		<th class="formHeader">Description
		<td>
			<input name="description" value="<%=description==null?"":description%>"/>
		</td>
	</tr>  
	<tr>
		<th class="formHeader">Type 
		<td> 
 			<select name="type">
 				<option value="" <%=type==null?"selected":""%>>Any
 				<option value="Contract" <%="Contract".equals(type)?"selected":""%>>Contract
				<option value="Permanent" <%="Permanent".equals(type)?"selected":""%>>Permanent
			</select> 
		</td> 
	</tr>
	<tr>       
		<th class="formHeader">Salary 
		<td>
 			<select name="salaryRange">
 				<option value="" <%=salaryRange==null?"selected":""%>>Any
<%
				String ranges[]={"20","30","40", "50","60","70","80","90","100","110","120","150","200"};
				for(int i=1;i<ranges.length;i++)
				{
					String rangeText=ranges[i-1]+"-"+ranges[i];
%>				
 					<option value="<%=rangeText%>" <%=rangeText.equals(salaryRange)?"selected":""%>><%=ranges[i-1]%> to <%=ranges[i]%>k
<%
				}
%>
			</select> 
		</td> 
	</tr>	
		
	<tr>
		<th class="formHeader">Locations  
		<td>   
<%
		String locs[]={"South","North","East","West"};  
		boolean allLocsBlank=true;
		for(int i=0;i<locs.length;i++)
		{			
			if(request.getParameter(locs[i])!=null)
			{
				allLocsBlank=false;
			}
		}
		for(int i=0;i<locs.length;i++)
		{			
%>		
			<input id='cb<%=locs[i]%>'  
				name="<%=locs[i]%>" 
<%
				if((allLocsBlank)||("on".equals(request.getParameter(locs[i])))) 	{
%>
					checked="checked" 			
<%				}	
%>								
				type="checkbox"/>
			<label for="cb<%=locs[i]%>"><%=locs[i]%>
<%
		}
%>		
		</td>		
	</tr>
	
	<tr>
		<th>
		<td>
			<input type="submit" value="search"/>
		</td>		
	</tr>
</table>
</form>	 
<%
		Document[] results=(Document[])request.getAttribute("results");
		if(results!=null)
		{
%>
			<table width="600">
				<tr>
					<th class="resultsHeader">Type
					<th class="resultsHeader">Location
					<th class="resultsHeader">Salary
					<th class="resultsHeader">Description
				</tr>
			<%
						for (int i = 0; i < results.length; i++)
						{
							Document doc = results[i];
			%>
				<tr class="resultsRow">  
					<td><%=doc.get("type")%>


my book on functional programming

 

new blog posts

 

Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.