Since subsequent requests differ only in the requested page of results, it is most efficient just to retrieve the most recent search request, change the value of the goToPage property, and resubmit the request. There are two ways to do this:

Note that resubmitting a modified request is useful for faceted search as well as for paging.

Example of Resubmitting the Form

If you do not want to save the request in the SearchSession, you will need to resubmit the form. Create a JavaScript function like this:

function nextPage(pageNum, requestChainToken)
  document.searchForm.requestChainToken.value = requestChainToken;
  document.searchForm.goToPage.value = pageNum;
  return false;

You can then invoke the function when the user clicks on a link for a specific page:

<a href="#" onclick="return nextPage('<%=pageValue.toString()%>',
  <dsp:valueof param="count"/>

When the link is clicked, the page number associated with the link and the requestChainToken of the current search response are passed to the function. The function uses these values to set the goToPage property and the requestChainToken property of the form, which it then submits. In addition to specifying the results page to display, this ensures that the same requestChainToken value is associated with each subsequent search request.

Example of Saving the Request in the SearchSession

If you save the request in the SearchSession, you can avoid the use of JavaScript. Instead, when a user clicks on a link for a page, you set the necessary properties (including the saveRequest property) on the saved request through dsp:property tags, and then resubmit the request:

<dsp:a href="queryExampleFastSave.jsp#Paging">
  <dsp:valueof param="count"/>
  <dsp:property bean="QueryFormHandler.goToPage" paramvalue="count"
    name="fh_gtp" priority="29"/>
  <dsp:property bean="QueryFormHandler.searchRequest.saveRequest"
    value="true" name="fh_sr" priority="30"/>
    name="fh_rct" priority="30"/>
loading table of contents...