Andy,

I am using this tag library: http://jsptags.com/tags/navigation/pager/index.jsp

You will have to hack the program a little and make sure to pass the correct variables. See basic example below:

Neal


<%-- PAGER OPTIONS --%>
<%
    String style = getParam(request, "style", "alltheweb");
    String position = getParam(request, "position", "top");
    String index = getParam(request, "index", "center");
    //int maxPageItems = getParam(request, "maxPageItems", 15);
    int maxPageItems = hitsPerPage;
    int maxIndexPages = getParam(request, "maxIndexPages", 9);

int myCount = (int)hits.getTotal(); //big total max results this changes a long value to an int value???
%>


Also: changed the startString from "start" variable to "pager.offset".

//  String startString = request.getParameter("start");
    String startString = request.getParameter("pager.offset");






<%-- START PAGINATION --%>


<%
//Check to see how far in the pagination you are.
if ((hits.totalIsExact() && end < hits.getTotal()) // more hits to show
    || (!hits.totalIsExact() && (hits.getLength() > start+hitsPerPage)))
   {
%>




<%
//Reset some variables
String hitsPerPage2 = request.getParameter("hitsPerPage");
String hitsPerSite2 = request.getParameter("hitsPerSite");
%>


<pg:pager
    items="<%= myCount %>"
    index="<%= index %>"
    maxPageItems="<%= maxPageItems %>"
    maxIndexPages="<%= maxIndexPages %>"
    isOffset="<%= true %>"
    export="offset,currentPageNumber=pageNumber"
    url="http://www.yourdomain.com:8080/search.jsp";
    scope="request">

  <pg:param name="query" value="<%= queryString %>"/>
  <pg:param name="hitsPerPage" value="<%= hitsPerPage2 %>"/>
  <pg:param name="hitsPerSite" value="<%= hitsPerSite2 %>"/>
  <pg:param name="clustering" value="<%= clustering %>"/>



<%-- keep track of preference --%>
  <pg:param name="style"/>
  <pg:param name="position"/>
  <pg:param name="index"/>
  <pg:param name="maxPageItems"/>
  <pg:param name="maxIndexPages"/>



  <%-- save pager offset during form changes --%>



  <%-- warn if offset is not a multiple of maxPageItems --%>
  <% if (offset.intValue() % maxPageItems != 0 &&
         ("alltheweb".equals(style) || "lycos".equals(style)) )
     {
  %>
    <p>Warning: The current page offset is not a multiple of Max. Page Items.
    <br>Please
    <pg:first><a href="<%= pageUrl %>">return to the first page</a></pg:first>
    if any displayed range numbers appear incorrect.</p>
  <% } %>

  <%-- the pg:pager items attribute must be set to the total number of
       items for index before items to work properly --%>
  <% if ("top".equals(position) || "both".equals(position)) { %>
    <br>
    <pg:index>
      <% if ("texticon".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/texticon.jsp" flush="true"/>
      <% } else if ("jsptags".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/jsptags.jsp" flush="true"/>
      <% } else if ("google".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/google.jsp" flush="true"/>
      <% } else if ("altavista".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/altavista.jsp" flush="true"/>
      <% } else if ("lycos".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/lycos.jsp" flush="true"/>
      <% } else if ("yahoo".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/yahoo.jsp" flush="true"/>
      <% } else if ("alltheweb".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/alltheweb.jsp" flush="true"/>
      <% } else { %>
        <jsp:include page="/WEB-INF/jsp/simple.jsp" flush="true"/>
      <% } %>
    </pg:index>
  <% } %>


You can put content here or just place this code block at the bottom of your page.



<% if ("bottom".equals(position) || "both".equals(position)) { %>
  <pg:index>
    <% if ("texticon".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/texticon.jsp" flush="true"/>
    <% } else if ("jsptags".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/jsptags.jsp" flush="true"/>
    <% } else if ("google".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/google.jsp" flush="true"/>
    <% } else if ("altavista".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/altavista.jsp" flush="true"/>
    <% } else if ("lycos".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/lycos.jsp" flush="true"/>
    <% } else if ("yahoo".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/yahoo.jsp" flush="true"/>
    <% } else if ("alltheweb".equals(style)) { %>
        <jsp:include page="/WEB-INF/jsp/alltheweb.jsp" flush="true"/>
    <% } else { %>
        <jsp:include page="/WEB-INF/jsp/simple.jsp" flush="true"/>
    <% } %>
  </pg:index>
<% } %>
</pg:pager>


<%
    }
%>

<%-- END PAGINATION --%>










At 10:07 AM 1/12/2006, you wrote:

How can we modify the results page.  I would like to have the pages
listed instead of the "next page" button.

Thanks,
Andy

Reply via email to