fix HTML (& must be escaped as & in URLs); escape query in the "more results" link; fix typos in comments

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2004-10-12 22:14:26 +00:00
parent ce7aaab8af
commit 46ceb15879
1 changed files with 10 additions and 9 deletions

View File

@ -1,13 +1,13 @@
<%@ page import = " javax.servlet.*, javax.servlet.http.*, java.io.*, org.apache.lucene.analysis.*, org.apache.lucene.document.*, org.apache.lucene.index.*, org.apache.lucene.search.*, org.apache.lucene.queryParser.*, org.apache.lucene.demo.*, org.apache.lucene.demo.html.Entities" %>
<%@ page import = " javax.servlet.*, javax.servlet.http.*, java.io.*, org.apache.lucene.analysis.*, org.apache.lucene.document.*, org.apache.lucene.index.*, org.apache.lucene.search.*, org.apache.lucene.queryParser.*, org.apache.lucene.demo.*, org.apache.lucene.demo.html.Entities, java.net.URLEncoder" %>
<%
/*
Author: Andrew C. Oliver, SuperLink Software, Inc. (acoliver2@users.sourceforge.net)
This jsp page is deliberatly written in the horrble java directly embedded
in the page style for an easy and conceise demonstration of Lucene.
This jsp page is deliberatly written in the horrible java directly embedded
in the page style for an easy and concise demonstration of Lucene.
Due note...if you write pages that look like this...sooner or later
you'll have a maintenance nightmere. If you use jsps...use taglibs
you'll have a maintenance nightmare. If you use jsps...use taglibs
and beans! That being said, this should be acceptable for a small
page demonstrating how one uses Lucene in a web app.
@ -68,11 +68,11 @@
query = QueryParser.parse(queryString, "contents", analyzer); //parse the
} catch (ParseException e) { //query and construct the Query
//object
//if its just "operator error"
//if it's just "operator error"
//send them a nice error HTML
%>
<p>Error While parsing query: <%=e.getMessage()%></p>
<p>Error while parsing query: <%=e.getMessage()%></p>
<%
error = true; //don't bother with the rest of
//the page
@ -126,9 +126,10 @@
<% if ( (startindex + maxpage) < hits.length()) { //if there are more results...display
//the more link
String moreurl="results.jsp?query=" + queryString + //construct the "more" link
"&maxresults=" + maxpage +
"&startat=" + (startindex + maxpage);
String moreurl="results.jsp?query=" +
URLEncoder.encode(queryString) + //construct the "more" link
"&amp;maxresults=" + maxpage +
"&amp;startat=" + (startindex + maxpage);
%>
<tr>
<td></td><td><a href="<%=moreurl%>">More Results>></a></td>