You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by dn...@apache.org on 2004/10/13 00:14:26 UTC
cvs commit: jakarta-lucene/src/jsp results.jsp
dnaber 2004/10/12 15:14:26
Modified: src/jsp results.jsp
Log:
fix HTML (& must be escaped as & in URLs); escape query in the "more results" link; fix typos in comments
Revision Changes Path
1.3 +10 -9 jakarta-lucene/src/jsp/results.jsp
Index: results.jsp
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/jsp/results.jsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- results.jsp 2 Apr 2002 05:15:43 -0000 1.2
+++ results.jsp 12 Oct 2004 22:14:26 -0000 1.3
@@ -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
+ "&maxresults=" + maxpage +
+ "&startat=" + (startindex + maxpage);
%>
<tr>
<td></td><td><a href="<%=moreurl%>">More Results>></a></td>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org