add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / xml-query-parser / src / demo / WebContent / index.jsp
1 <!--
2     Licensed to the Apache Software Foundation (ASF) under one or more
3     contributor license agreements.  See the NOTICE file distributed with
4     this work for additional information regarding copyright ownership.
5     The ASF licenses this file to You under the Apache License, Version 2.0
6     the "License"); you may not use this file except in compliance with
7     the License.  You may obtain a copy of the License at
8  
9         http://www.apache.org/licenses/LICENSE-2.0
10  
11     Unless required by applicable law or agreed to in writing, software
12     distributed under the License is distributed on an "AS IS" BASIS,
13     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14     See the License for the specific language governing permissions and
15     limitations under the License.
16  -->
17 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
18 import="org.apache.lucene.search.*,org.apache.lucene.document.*"
19 pageEncoding="ISO-8859-1"%>
20 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
21 <html>
22 <head>
23         <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
24         <link rel="stylesheet" type="text/css" href="stylesheet.css">
25         <title>XML Query Parser demo</title>
26 </head>
27 <body>
28 <h1>Job Search</h1>
29 <%
30                         // Load form variables
31                         String description=request.getParameter("description");
32                         String type=request.getParameter("type");
33                         String salaryRange=request.getParameter("salaryRange"); 
34 %>
35 <form method="POST" action="FormBasedXmlQueryDemo">
36 <table >
37         <tr>
38                 <th class="formHeader">Description</th>
39                 <td>
40                         <input name="description" value="<%=description==null?"":description%>"/>
41                 </td>
42         </tr>  
43         <tr>
44                 <th class="formHeader">Type</th> 
45                 <td> 
46                         <select name="type">
47                                 <option value="" <%=type==null?"selected":""%>>Any</option>
48                                 <option value="Contract" <%="Contract".equals(type)?"selected":""%>>Contract</option>
49                                 <option value="Permanent" <%="Permanent".equals(type)?"selected":""%>>Permanent</option>
50                         </select> 
51                 </td> 
52         </tr>
53         <tr>       
54                 <th class="formHeader">Salary</th> 
55                 <td>
56                         <select name="salaryRange">
57                                 <option value="" <%=salaryRange==null?"selected":""%>>Any</option>
58 <%
59                                 String ranges[]={"20","30","40", "50","60","70","80","90","100","110","120","150","200"};
60                                 for(int i=1;i<ranges.length;i++)
61                                 {
62                                         String rangeText=ranges[i-1]+"-"+ranges[i];
63 %>                              
64                                         <option value="<%=rangeText%>" <%=rangeText.equals(salaryRange)?"selected":""%>><%=ranges[i-1]%> to <%=ranges[i]%>k</option>
65 <%
66                                 }
67 %>
68                         </select> 
69                 </td> 
70         </tr>   
71                 
72         <tr>
73                 <th class="formHeader">Locations</th>  
74                 <td>   
75 <%
76                 String locs[]={"South","North","East","West"};  
77                 boolean allLocsBlank=true;
78                 for(int i=0;i<locs.length;i++)
79                 {                       
80                         if(request.getParameter(locs[i])!=null)
81                         {
82                                 allLocsBlank=false;
83                         }
84                 }
85                 for(int i=0;i<locs.length;i++)
86                 {                       
87 %>              
88                         <input id='cb<%=locs[i]%>'  
89                                 name="<%=locs[i]%>" 
90 <%
91                                 if((allLocsBlank)||("on".equals(request.getParameter(locs[i]))))        {
92 %>
93                                         checked="checked"                       
94 <%                              }       
95 %>                                                              
96                                 type="checkbox"/>
97                         <label for="cb<%=locs[i]%>"><%=locs[i]%></label>
98 <%
99                 }
100 %>              
101                 </td>           
102         </tr>
103         
104         <tr>
105                 <th></th>
106                 <td>
107                         <input type="submit" value="search"/>
108                 </td>           
109         </tr>
110 </table>
111 </form>  
112 <%
113                 Document[] results=(Document[])request.getAttribute("results");
114                 if(results!=null)
115                 {
116 %>
117                         <table width="600">
118                                 <tr>
119                                         <th class="resultsHeader">Type</th>
120                                         <th class="resultsHeader">Location</th>
121                                         <th class="resultsHeader">Salary</th>
122                                         <th class="resultsHeader">Description</th>
123                                 </tr>
124                         <%
125                                                 for (int i = 0; i < results.length; i++)
126                                                 {
127                                                         Document doc = results[i];
128                         %>
129                                 <tr class="resultsRow">  
130                                         <td><%=doc.get("type")%></td>
131                                         <td><%=doc.get("location")%></td>
132                                         <td class="resultNum"><%=doc.get("salary")%>,000</td>
133                                         <td><%=doc.get("description")%></td>
134                                 </tr>
135
136                         <%                      
137                                                 }
138                         %>      
139                         </table>
140                         
141 <%                                      
142                 }//end if has results
143 %>      
144 </body>
145 </html>