You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by si...@apache.org on 2006/05/02 20:26:51 UTC
svn commit: r399002 - in /lucene/nutch/trunk/contrib/web2: ./ lib/
src/main/java/org/apache/nutch/webapp/common/
src/main/java/org/apache/nutch/webapp/controller/
src/main/java/org/apache/nutch/webapp/tiles/ src/main/webapp/WEB-INF/
src/main/webapp/WEB...
Author: siren
Date: Tue May 2 11:26:46 2006
New Revision: 399002
URL: http://svn.apache.org/viewcvs?rev=399002&view=rev
Log:
convert from struts tags to jstl tags, fix navigation
Added:
lucene/nutch/trunk/contrib/web2/lib/jstl.jar (with props)
lucene/nutch/trunk/contrib/web2/lib/standard.jar (with props)
Removed:
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/tld/struts-bean.tld
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/tld/struts-logic.tld
Modified:
lucene/nutch/trunk/contrib/web2/build.xml
lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.java
lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java
lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.java
lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.java
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jsp
lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/web.xml
Modified: lucene/nutch/trunk/contrib/web2/build.xml
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/build.xml?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/build.xml (original)
+++ lucene/nutch/trunk/contrib/web2/build.xml Tue May 2 11:26:46 2006
@@ -41,6 +41,9 @@
<include name="servlet-api.jar" />
<include name="hadoop-0.1.1.jar" />
</fileset>
+ <fileset dir="${nutch.root}/lib/jetty-ext">
+ <include name="jsp-api.jar" />
+ </fileset>
</path>
<!--
@@ -283,6 +286,7 @@
<fixcrlf srcdir="${docs.dir}" eol="lf" encoding="utf-8"
includes="**/*.html"/>
+ <replace dir="${docs.dir}" token="help.html" value="help.do" includes="**/*.html"/>
<replace dir="${docs.dir}" token="search.jsp" value="search.do" includes="**/*.html"/>
<replace dir="${docs.dir}" token="../" value="" includes="**/*.html"/>
Added: lucene/nutch/trunk/contrib/web2/lib/jstl.jar
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/lib/jstl.jar?rev=399002&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/nutch/trunk/contrib/web2/lib/jstl.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/nutch/trunk/contrib/web2/lib/standard.jar
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/lib/standard.jar?rev=399002&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/nutch/trunk/contrib/web2/lib/standard.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.java?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.java (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.java Tue May 2 11:26:46 2006
@@ -22,7 +22,7 @@
*/
public class NavigationHelper {
- private int pageStart;
+ private int start;
private int hitsPerPage;
@@ -30,26 +30,49 @@
private boolean totalIsExact;
- public NavigationHelper(int pageStart, int hitsPerPage, long totalHits,
+ private int end;
+
+ /**
+ * Construct a new NavigationHelper
+ * @param start start index
+ * @param hitsPerPage
+ * @param length total number of hits
+ * @param totalIsExact total number of hits is exact (@see org.apache.nutch.searcher.Hits#setTotalIsExact(boolean))
+ */
+ public NavigationHelper(int start, int end, int hitsPerPage, long length,
boolean totalIsExact) {
- this.pageStart = pageStart;
+ this.start = start;
+ this.end = end;
this.hitsPerPage = hitsPerPage;
- this.totalHits = totalHits;
+ this.totalHits = length;
this.totalIsExact = totalIsExact;
}
- protected Boolean hasPrev() {
- return new Boolean(pageStart > 0);
+ /**
+ * Is there a previous page available
+ *
+ * @return
+ */
+ protected boolean hasPrev() {
+ return start > 0;
}
- protected Boolean hasNext() {
- return new Boolean((totalIsExact && pageStart + hitsPerPage < totalHits)
- || (!totalIsExact && totalHits > pageStart + hitsPerPage));
-
+ /**
+ * Is there a next page available
+ * @return
+ */
+ protected boolean hasNext() {
+ System.out.println("totalIsExact" + totalIsExact);
+ System.out.println("end" + end);
+ System.out.println("totalHits" + totalHits);
+ return end < totalHits && (!getShowAllHits());
}
- protected void next() {
- pageStart += hitsPerPage;
+ /**
+ * Proceed to next page
+ */
+ protected void nextPage() {
+ start += hitsPerPage;
}
/**
@@ -57,24 +80,39 @@
*
* @return
*/
- public long getNextStart() {
- return pageStart + hitsPerPage;
+ public long getNextPageStart() {
+ return start + hitsPerPage;
}
+ /**
+ * Proceed to previous page
+ */
public void prev() {
- pageStart -= hitsPerPage;
+ start -= hitsPerPage;
}
+ /**
+ * Get a page number
+ * @return
+ */
public int getPageNumber() {
- return pageStart / hitsPerPage;
+ return start / hitsPerPage;
}
- protected Boolean getShowAllHits() {
- return new Boolean(!totalIsExact && (totalHits <= pageStart + hitsPerPage));
+ /**
+ *
+ * @return
+ */
+ protected boolean getShowAllHits() {
+ return !totalIsExact && (start + hitsPerPage > end);
}
+ /**
+ * Returns the numer of last hit on page
+ * @return
+ */
public long getEnd() {
- return Math.min(totalHits, getNextStart());
+ return Math.min(totalHits, getNextPageStart());
}
}
Modified: lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java Tue May 2 11:26:46 2006
@@ -89,25 +89,28 @@
hits = new Hits(0, new Hit[0]);
}
- navigationHelper = new NavigationHelper(startOffset, hitsPerPage, hits
- .getTotal(), hits.totalIsExact());
-
- // set offset to next page to form so it get's to ui
- if (navigationHelper.hasNext().booleanValue()) {
- form.setValue(SearchForm.NAME_START, Long.toString(navigationHelper
- .getNextStart()));
- }
-
LOG.info("form:");
LOG.info(locator.getSearchForm().toString());
LOG.info("performing search");
- // found some unused code ?
int realEnd = (int) Math.min(hits.getLength(), getStartOffset()
+ getMaxHits());
+ int endOffset=hits.getLength();
+
show = hits.getHits(getStartOffset(), realEnd - getStartOffset());
+
+
+ navigationHelper = new NavigationHelper(startOffset, endOffset, hitsPerPage, hits
+ .getTotal(), hits.totalIsExact());
+
+ // set offset to next page to form so it get's to ui
+ if (navigationHelper.hasNext()) {
+ form.setValue(SearchForm.NAME_START, Long.toString(navigationHelper
+ .getNextPageStart()));
+ }
+
try {
details = bean.getDetails(show);
summaries = bean.getSummary(details, getQuery());
@@ -393,14 +396,14 @@
/**
* @return true if more results available
*/
- public Boolean getHasNextPage() {
+ public boolean getHasNextPage() {
return navigationHelper.hasNext();
}
/**
* @return true if previous page if available
*/
- public Boolean getHasPrevPage() {
+ public boolean getHasPrevPage() {
return navigationHelper.hasPrev();
}
@@ -420,7 +423,13 @@
return form.getActive();
}
- public Boolean getShowAllHits() {
+ public boolean getShowAllHits() {
+ if(navigationHelper.getShowAllHits()){
+ //remove start parameter from form
+ getForm().remove(SearchForm.NAME_START);
+ //add hitsPerDup=0
+ getForm().setValue(SearchForm.NAME_HITSPERDUP,"0");
+ }
return navigationHelper.getShowAllHits();
}
@@ -429,11 +438,11 @@
*
* @return
*/
- public Boolean getHasResults() {
- return new Boolean(hits.getTotal() > 0);
+ public boolean getHasResults() {
+ return hits.getTotal() > 0;
}
- public Boolean getIsSearch() {
- return new Boolean(queryString == null || queryString.trim().equals(""));
+ public boolean getIsSearch() {
+ return queryString != null && !queryString.trim().equals("");
}
}
Modified: lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.java?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.java (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.java Tue May 2 11:26:46 2006
@@ -47,5 +47,6 @@
// put explanation and hitDetails into request so view can access them
request.setAttribute("explanation", bean.getExplanation(query, hit));
request.setAttribute("hitDetails", details.toHtml());
+ request.setAttribute("query", query);
}
}
Modified: lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.java?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.java (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.java Tue May 2 11:26:46 2006
@@ -17,10 +17,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.jstl.core.Config;
import org.apache.nutch.webapp.common.ServiceLocator;
import org.apache.nutch.webapp.common.WebappInstanceServiceLocator;
-import org.apache.struts.Globals;
import org.apache.struts.tiles.TilesRequestProcessor;
public class NutchRequestProcessor extends TilesRequestProcessor {
@@ -37,8 +37,9 @@
if(locator==null) {
locator=new WebappInstanceServiceLocator(request, getServletContext());
+ WebappInstanceServiceLocator.register(request, (WebappInstanceServiceLocator)locator);
}
- request.setAttribute(Globals.LOCALE_KEY, locator.getLocale());
+ Config.set(request, Config.FMT_LOCALE, locator.getLocale());
}
}
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jsp Tue May 2 11:26:46 2006
@@ -1,13 +1,11 @@
<%@ include file="common.jsp"%>
-<jsp:useBean id="nutchAnchors" scope="request"
- type="org.apache.nutch.webapp.controller.AnchorsController.AnchorsBean" />
-<h3><bean:message key="anchors.page" arg0="<%=nutchAnchors.getUrl()%>" />
-</h3>
-<h3><bean:message key="anchors.anchors" /></h3>
+<h3><fmt:message key="anchors.page">
+ <fmt:param value="${nutchAnchors.url}" />
+</fmt:message></h3>
+<h3><fmt:message key="anchors.anchors" /></h3>
<ul>
- <logic:iterate scope="request" id="anchor" name="nutchAnchors"
- property="anchors" type="String">
- <li><bean:write name="anchor" /></li>
- </logic:iterate>
+ <c:forEach var="anchor" items="${nutchAnchors.anchors}">
+ <li><c:out value="${anchor}" /></li>
+ </c:forEach>
</ul>
<br />
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jsp Tue May 2 11:26:46 2006
@@ -1,4 +1,4 @@
<%@ page session="false" %>
<%@ taglib prefix="tiles" uri="/tags/struts-tiles" %>
-<%@ taglib prefix="bean" uri="/tags/struts-bean" %>
-<%@ taglib prefix="logic" uri="/tags/struts-logic" %>
+<%@ taglib prefix="c" uri="/tags/jstl-c" %>
+<%@ taglib prefix="fmt" uri="/tags/jstl-fmt" %>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jsp Tue May 2 11:26:46 2006
@@ -1,7 +1,6 @@
<%@ include file="common.jsp" %>
-<h3><bean:message key="explain.page"/></h3>
-<bean:parameter id="query" name="query"/>
-<bean:write name="hitDetails" filter="false"/>
-<h3><bean:message arg0="<%=query%>" key="explain.scoreForQuery" />
+<h3><fmt:message key="explain.page"/></h3>
+<c:out value="${hitDetails}" escapeXml="false"/>
+<h3><fmt:message key="explain.scoreForQuery"><fmt:param value="${query}"/></fmt:message>
</h3>
-<bean:write name="explanation" filter="false"/>
+<c:out value="${explanation}" escapeXml="false"/>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jsp Tue May 2 11:26:46 2006
@@ -1,10 +1,11 @@
<%@ include file="common.jsp"%>
-<div id="footer"><logic:present name="nutchSearch">
+<div id="footer"><c:if test="${nutchSearch.isSearch=='true'}">
<table bgcolor="3333ff" align="right">
<tr>
- <td bgcolor="ff9900"><a href="opensearch?query=<bean:write name="nutchSearch" property="queryString"/>"><font color="ffffff"><b>RSS</b>
- </font></a></td>
+ <td bgcolor="ff9900"><a
+ href="opensearch?query=<c:out value="${nutchSearch.queryString}"/>"><font
+ color="ffffff"><b>RSS</b> </font></a></td>
</tr>
</table>
-</logic:present> <a href="http://wiki.apache.org/nutch/FAQ"> <img
- border="0" src="img/poweredbynutch_01.gif"> </a></div>
+</c:if> <a href="http://wiki.apache.org/nutch/FAQ"> <img border="0"
+ src="img/poweredbynutch_01.gif"> </a></div>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jsp Tue May 2 11:26:46 2006
@@ -2,18 +2,18 @@
<tiles:useAttribute name="title" ignore="true"
classname="java.lang.String" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title><bean:message name="title" /><logic:present name="nutchSearch"> - <bean:write
- name="nutchSearch" property="queryString" />
-</logic:present></title>
+<title><fmt:message key="${title}" /><c:if test="${nutchSearch!=null}"> - <c:out
+ value="${nutchSearch.queryString}" />
+</c:if></title>
<link rel="icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<tiles:insert name="style" />
-<logic:present name="nutchSearch">
+<c:if test="${nutchSearch!=null}">
<link rel="alternate" type="application/rss+xml" title="RSS"
- href="opensearch?query=<bean:write name="nutchSearch" property="queryString"/>" />
+ href="opensearch?query=<c:out value="${nutchSearch.queryString}"/>" />
<script type="text/javascript">
<!--
function queryfocus() { document.search.query.focus(); }
// -->
</script>
-</logic:present>
+</c:if>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jsp Tue May 2 11:26:46 2006
@@ -1,2 +1,2 @@
<%@ include file="common.jsp" %>
-<bean:write name="content" scope="request" filter="false"/>
+<c:out value="${content}" escapeXml="false"/>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jsp Tue May 2 11:26:46 2006
@@ -1,14 +1,21 @@
-<div id="navigation">
<%@ include file="common.jsp"%>
-<logic:equal name="nutchSearch" property="hasNextPage" value="true">
+<div id="navigation">
+<c:if test="${nutchSearch.hasNextPage==true}">
+ <form name="search" action="search.do" method="get"><input
+ type="submit" value="<fmt:message key="search.next"/>">
+ <c:forEach var="urlParameter" items="${nutchSearch.formProperties}">
+ <input type="hidden"
+ name="<c:out value="${urlParameter.key}"/>"
+ value="<c:out value="${urlParameter.value}"/>" />
+ </c:forEach></form>
+</c:if>
+<c:if test="${nutchSearch.showAllHits==true}">
<form name="search" action="search.do" method="get"><input
- type="submit" value="<bean:message key="search.next"/>"> <logic:iterate
- scope="request" id="urlParameter" name="nutchSearch"
- property="formProperties"
- type="org.apache.nutch.webapp.common.SearchForm.KeyValue">
+ type="submit" value="<fmt:message key="search.showAllHits"/>">
+ <c:forEach var="urlParameter" items="${nutchSearch.formProperties}">
<input type="hidden"
- name="<bean:write name="urlParameter" property="key"/>"
- value="<bean:write name="urlParameter" property="value"/>" />
- </logic:iterate></form>
-</logic:equal>
+ name="<c:out value="${urlParameter.key}"/>"
+ value="<c:out value="${urlParameter.value}"/>" />
+ </c:forEach></form>
+</c:if>
</div>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jsp Tue May 2 11:26:46 2006
@@ -1,5 +1,4 @@
-<div id="noResults"><%@ include file="common.jsp"%> <jsp:useBean
- id="nutchSearch" scope="request"
- type="org.apache.nutch.webapp.common.Search" /> <bean:message
- key="search.noResults" arg0="<%= nutchSearch.getHtmlQueryString()%>" />
+<div id="noResults"><%@ include file="common.jsp"%>
+<fmt:message
+ key="search.noResults"><fmt:param value="${nutchSearch.htmlQueryString}"/></fmt:message>
</div>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jsp Tue May 2 11:26:46 2006
@@ -1,17 +1,16 @@
<%@ include file="common.jsp" %>
-<logic:iterate scope="request" id="hit" name="nutchSearch" property="results" type="org.apache.nutch.webapp.common.SearchResultBean">
- <b><a href="<bean:write name="hit" property="url"/>"><bean:write name="hit" property="title"/></a></b><br/>
+<c:forEach var="hit" items="${nutchSearch.results}">
+ <b><a href="<c:out value="${hit.url}"/>"><c:out value="${hit.title}"/></a></b><br/>
<tiles:insert name="more" flush="false" beanName="hit"/>
- <bean:write name="hit" property="summary" filter="false"/>
+ <c:out value="${hit.summary}" escapeXml="false"/>
<br>
- <span class="url"><bean:write name="hit" property="encodedUrl"/></span>
- (<a href="cached.do?<bean:write name="hit" property="id"/>"><bean:message key="search.cached"/></a>)
- (<a href="explain.do?<bean:write name="hit" property="id"/>&query=<bean:write name="hit" property="urlEncodedQuery"/>"><bean:message key="search.explain"/></a>)
- (<a href="anchors.do?<bean:write name="hit" property="id"/>"><bean:message key="search.anchors"/></a>)
-<logic:equal name="hit" property="hasMore" value="true">
- (<a href="search.do?<bean:write name="hit" property="moreUrl"/>"><bean:message key="search.moreFrom"/>
- <bean:write name="hit" property="dedupValue"/></a>)
-</logic:equal>
+ <span class="url"><c:out value="${hit.encodedUrl}"/></span>
+ (<a href="cached.do?<c:out value="${hit.id}"/>"><fmt:message key="search.cached"/></a>)
+ (<a href="explain.do?<c:out value="${hit.id}"/>&query=<c:out value="${hit.urlEncodedQuery}"/>"><fmt:message key="search.explain"/></a>)
+ (<a href="anchors.do?<c:out value="${hit.id}"/>"><fmt:message key="search.anchors"/></a>)
+<c:if test="${hit.hasMore==true}">
+ (<a href="search.do?<c:out value="${hit.moreUrl}"/>"><fmt:message key="search.moreFrom"/>
+ <c:out value="${hit.dedupValue}"/></a>)
+</c:if>
<br/><br/>
-</logic:iterate>
-</div>
+</c:forEach>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp Tue May 2 11:26:46 2006
@@ -1,28 +1,28 @@
<%@ include file="common.jsp"%>
-<logic:match name="nutchSearch" property="isSearch" value="false">
- <jsp:useBean id="resultInfo" scope="request" type="String[]" />
+<c:if test="${nutchSearch.isSearch == true}">
<form name="search" action="search.do" method="get"><input name="query"
- size="44"
- value="<bean:write name="nutchSearch" property="queryString"/>"> <input
- type="hidden" name="hitsPerPage"
- value="<bean:write name="nutchSearch" property="hitsPerPage"/>"> <input
- type="submit" value="<bean:message key="search.search" />"> <a
- href="help.do"><bean:message key="search.help" /></a></form>
- <logic:match name="nutchSearch" property="hasResults" value="true">
- <bean:message key="search.hits" arg0="<%=resultInfo[0]%>"
- arg1="<%=resultInfo[1]%>" arg2="<%=resultInfo[2]%>"
- arg3="<%=resultInfo[3]%>" />
+ size="44" value="<c:out value="${nutchSearch.queryString}"/>">
+ <input
+ type="submit" value="<fmt:message key="search.search"/>"> <a
+ href="help.do"><fmt:message key="search.help" /></a></form>
+ <c:if test="${nutchSearch.hasResults == true }">
+ <fmt:message key="search.hits">
+ <fmt:param value="${resultInfo[0]}" />
+ <fmt:param value="${resultInfo[1]}" />
+ <fmt:param value="${resultInfo[2]}" />
+ <fmt:param value="${resultInfo[3]}" />
+ </fmt:message>
<br />
<tiles:insert name="results" />
<tiles:insert name="cluster" />
<tiles:insert name="navigate" />
- </logic:match>
- <logic:notMatch name="nutchSearch" property="hasResults" value="true">
+ </c:if>
+ <c:if test="${nutchSearch.hasResults == false }">
<tiles:insert name="noResults" />
- </logic:notMatch>
-</logic:match>
-<logic:notMatch name="nutchSearch" property="isSearch" value="false">
+ </c:if>
+</c:if>
+<c:if test="${nutchSearch.isSearch == false}">
<tiles:insert name="i18nComponent">
<tiles:put name="basePage" value="/search.html" />
</tiles:insert>
-</logic:notMatch>
+</c:if>
\ No newline at end of file
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jsp
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jsp?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jsp (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jsp Tue May 2 11:26:46 2006
@@ -1,17 +1,17 @@
<%@page contentType="text/html; charset=utf-8" session="false"%>
<%@ include file="common.jsp"%>
-<html lang="<bean:message key="lang"/>">
+<html lang="<fmt:message key="lang"/>">
<head>
<tiles:insert name="header">
<tiles:put name="title" beanName="title" />
<tiles:put name="basePage" content="/include/header.html" />
- <tiles:put name="attrName" content="header" />
+ <tiles:put name="attrName" content="headerContent" />
</tiles:insert>
</head>
- <body onLoad="queryfocus();">
- <bean:write name="header" scope="request" filter="false" ignore="true"/>
+<body onLoad="queryfocus();">
+<c:out default="" value="${headerContent}" escapeXml="false"/>
<tiles:insert name="pageBody" />
<tiles:insert name="footer" />
- </body>
+</body>
</html>
Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/web.xml?rev=399002&r1=399001&r2=399002&view=diff
==============================================================================
--- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/web.xml (original)
+++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/web.xml Tue May 2 11:26:46 2006
@@ -7,7 +7,7 @@
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
- <param-value>ApplicationResources</param-value>
+ <param-value>org.nutch.jsp.resources</param-value>
</context-param>
<servlet>
<servlet-name>action</servlet-name>
@@ -54,15 +54,15 @@
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
- <taglib-uri>/tags/struts-logic</taglib-uri>
- <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
- </taglib>
- <taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
- <taglib-uri>/tags/struts-bean</taglib-uri>
- <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
+ <taglib-uri>/tags/jstl-c</taglib-uri>
+ <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
+ </taglib>
+ <taglib>
+ <taglib-uri>/tags/jstl-fmt</taglib-uri>
+ <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
</web-app>