<font size=2 face="sans-serif">Hi All,</font>
<br><font size=2 face="sans-serif">           I
have written a customize search page which search for content on opencms
9 system. search working perfectly when user logined(as Admin) and pagination
also working perfectly. But when i logged out and try to search any content
then first page displayed correctly but pagination did not working, it
does not taking me to the next page while i press next button in pagination
or click any number in pagination. What exactly problem with the pagination
i did not understand as in url page number also getting changed for pagination.
Please help on this, code is given below:</font>
<br>
<br><font size=2 face="sans-serif"><%@ page buffer="8kb" import="org.opencms.main.*,
org.opencms.search.*, org.opencms.file.*, org.opencms.jsp.*, java.util.*"
%></font>
<br><font size=2 face="sans-serif"><%@ page taglibs="c,cms,fn"
%></font>
<br><font size=2 face="sans-serif"><%@page session = "false"
trimDirectiveWhitespaces="true" import = "org.opencms.jsp.CmsJspActionElement"%></font>
<br><font size=2 face="sans-serif"><%@page import = "org.opencms.file.CmsObject,org.opencms.relations.CmsCategoryService,
org.opencms.file.CmsResource, java.util.List, java.util.Iterator, java.text.SimpleDateFormat,
java.util.Date"%></font>
<br><font size=2 face="sans-serif"><%@page import = "org.opencms.file.CmsPropertyDefinition,
java.util.Comparator, java.util.Collections" %></font>
<br>
<br><font size=2 face="sans-serif">        </font>
<br><font size=2 face="sans-serif">        <%</font>
<br><font size=2 face="sans-serif">         
      org.opencms.jsp.CmsJspActionElement cms =
new CmsJspActionElement(pageContext, request, response);</font>
<br><font size=2 face="sans-serif">         
      </font>
<br><font size=2 face="sans-serif">         
      // Get the search manager</font>
<br><font size=2 face="sans-serif">         
      CmsSearchManager searchManager = OpenCms.getSearchManager();
</font>
<br><font size=2 face="sans-serif">        %></font>
<br><font size=2 face="sans-serif">        <jsp:useBean
id="search" scope="request" class="org.opencms.search.CmsSearch"></font>
<br><font size=2 face="sans-serif">         
      <jsp:setProperty name = "search"
property="*"/></font>
<br><font size=2 face="sans-serif">         
      <%</font>
<br><font size=2 face="sans-serif">         
              search.setMatchesPerPage(25);</font>
<br><font size=2 face="sans-serif">         
      %></font>
<br><font size=2 face="sans-serif">        </jsp:useBean></font>
<br><font size=2 face="sans-serif">        <%</font>
<br><font size=2 face="sans-serif">         
      Enumeration parameter = request.getParameterNames();</font>
<br><font size=2 face="sans-serif">         
      if(!parameter.hasMoreElements()){</font>
<br><font size=2 face="sans-serif">         
              response.sendRedirect("domain-name/search");</font>
<br><font size=2 face="sans-serif">         
              return;</font>
<br><font size=2 face="sans-serif">         
      }</font>
<br><font size=2 face="sans-serif">           
if( request.getParameter("query") ==null){</font>
<br><font size=2 face="sans-serif">         
              search.init(cms.getCmsObject());</font>
<br><font size=2 face="sans-serif">         
      }else{</font>
<br><font size=2 face="sans-serif">         
              search.setQuery(request.getParameter("query"));</font>
<br><font size=2 face="sans-serif">         
              application.setAttribute("query",request.getParameter("query"));</font>
<br><font size=2 face="sans-serif">         
              search.init(cms.getCmsObject());</font>
<br><font size=2 face="sans-serif">         
      }</font>
<br><font size=2 face="sans-serif">         
      // Create a JSP action element</font>
<br><font size=2 face="sans-serif">    %></font>
<br>
<br><font size=2 face="sans-serif">         
               
      <div class="search-result"></font>
<br><font size=2 face="sans-serif">         
               
              <h1
class="margin-bottom-10">Search result</h1></font>
<br><font size=2 face="sans-serif">         
               
              </font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
      int resultno = 1;</font>
<br><font size=2 face="sans-serif">         
               
               
      int pageno = 0;</font>
<br><font size=2 face="sans-serif">         
               
               
      if (request.getParameter("searchPage")!=null)
{                </font>
<br><font size=2 face="sans-serif">         
               
               
              pageno
= Integer.parseInt(request.getParameter("searchPage"))-1;</font>
<br><font size=2 face="sans-serif">         
               
               
      }</font>
<br><font size=2 face="sans-serif">         
               
               
      resultno = (pageno*search.getMatchesPerPage())+1;</font>
<br><font size=2 face="sans-serif">         
               
               
      </font>
<br><font size=2 face="sans-serif">         
               
               
      String fields = search.getFields();</font>
<br><font size=2 face="sans-serif">         
               
               
 if (fields==null) {</font>
<br><font size=2 face="sans-serif">         
               
               
      fields = request.getParameter("fields");</font>
<br><font size=2 face="sans-serif">         
               
               
 }</font>
<br><font size=2 face="sans-serif">         
               
               
      </font>
<br><font size=2 face="sans-serif">         
               
               
 List result = search.getSearchResult();</font>
<br><font size=2 face="sans-serif">         
               
               
 if (result == null) {</font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
              if (search.getLastException()
!= null) { </font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
              <h3>Error</h3></font>
<br><font size=2 face="sans-serif">         
               
              <%=
search.getLastException().toString() %> </font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
              }</font>
<br><font size=2 face="sans-serif">         
               
              </font>
<br><font size=2 face="sans-serif">         
               
               
      } else {</font>
<br><font size=2 face="sans-serif">         
               
               
      </font>
<br><font size=2 face="sans-serif">         
               
               
              ListIterator
iterator = result.listIterator();</font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
              <h3
class="result-found margin-bottom-10"><%= search.getSearchResult().size()
%> Results found for query &lt; <%= application.getAttribute("query")
%> &gt;</h3></font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
              while
(iterator.hasNext()) {</font>
<br><font size=2 face="sans-serif">         
               
               
               
      CmsSearchResult entry = (CmsSearchResult)iterator.next();</font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
              <div
class="result-row" id="result-row-<%=resultno%>"
onmouseout="outWrapper('<%=resultno%>')" onmouseover="hoverWrapper(<%=resultno%>)"></font>
<br><font size=2 face="sans-serif">         
               
               
      <a class="result-record" href="<%=
cms.link(cms.getRequestContext().removeSiteRoot(entry.getPath())) %>"></font>
<br><font size=2 face="sans-serif">         
               
               
              <h3
class="margin-bottom-10" style="line-height:1.6;" id="title-<%=resultno%>"><%=
entry.getTitle() %></h3></font>
<br><font size=2 face="sans-serif">         
               
               
              <span
class="img-date-wrapper"></font>
<br><font size=2 face="sans-serif">         
               
               
               
      <h6 class="created-date" id="created-date-<%=resultno%>"><%=
entry.getDateCreated() %></h6></font>
<br><font size=2 face="sans-serif">         
               
               
              </span></font>
<br><font size=2 face="sans-serif">         
               
               
              <span
class="desc-wrapper"></font>
<br><font size=2 face="sans-serif">         
               
               
               
      <h5 class="desc" id="desc-<%=resultno%>"><%
if(entry.getExcerpt()==null || entry.getExcerpt()==""){out.println("No
description available.");}else{ out.println(""+entry.getExcerpt()+"
...");} %></h5></font>
<br><font size=2 face="sans-serif">         
               
               
              </span></font>
<br><font size=2 face="sans-serif">         
               
               
              </font>
<br><font size=2 face="sans-serif">         
               
               
      </a></font>
<br><font size=2 face="sans-serif">         
               
              </div>
               
       </font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
              resultno++;
           </font>
<br><font size=2 face="sans-serif">         
               
               
              }</font>
<br><font size=2 face="sans-serif">         
               
               
      }</font>
<br><font size=2 face="sans-serif">         
               
              %>
</font>
<br><font size=2 face="sans-serif">         
               
              <div
class="next-prev-paging-wrapper margin-bottom-10"></font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
      if (search.getPreviousUrl() != null) {</font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
               
              &nbsp;&nbsp;<input
type="button" class="btn-u previous" value="&lt;&lt;
previous" onclick="location.href='<%= cms.link(search.getPreviousUrl())
%>';"></font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
      }</font>
<br><font size=2 face="sans-serif">         
               
               
      Map pageLinks = search.getPageLinks();</font>
<br><font size=2 face="sans-serif">         
               
               
      Iterator i =  pageLinks.keySet().iterator();</font>
<br><font size=2 face="sans-serif">         
               
               
      out.println("<div class='paging'>");</font>
<br><font size=2 face="sans-serif">         
               
               
      while (i.hasNext()) {</font>
<br><font size=2 face="sans-serif">         
               
               
              int pageNumber
= ((Integer)i.next()).intValue();</font>
<br><font size=2 face="sans-serif">         
               
               
              String
pageLink = cms.link((String)pageLinks.get(new Integer(pageNumber)));</font>
<br><font size=2 face="sans-serif">         
               
               
              if (pageNumber
!= search.getSearchPage()) {</font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
               
               
      <a href="<%= pageLink %>&fields=<%=
fields %>"><%= pageNumber %></a></font>
<br><font size=2 face="sans-serif">         
               
               
               
      </font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
              } else
{</font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
               
               
      <span class="currentpage"><%=
pageNumber %></span></font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
              }</font>
<br><font size=2 face="sans-serif">         
               
               
      }</font>
<br><font size=2 face="sans-serif">         
               
               
      out.println("</div>");</font>
<br><font size=2 face="sans-serif">         
               
               
      if (search.getNextUrl() != null) {</font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
               
              &nbsp;
&nbsp;<input type="button" class="btn-u next"
value="next &gt;&gt;" onclick="location.href='<%=
cms.link(search.getNextUrl()) %>';"></font>
<br><font size=2 face="sans-serif">         
               
               
              </font>
<br><font size=2 face="sans-serif">         
               
              <%</font>
<br><font size=2 face="sans-serif">         
               
               
      } </font>
<br><font size=2 face="sans-serif">         
               
              %></font>
<br><font size=2 face="sans-serif">         
               
              </div></font>
<br><font size=2 face="sans-serif">         
               
      </div></font>
<br>
<br>
<br><font size=2 face="sans-serif">Cheers</font>
<br><font size=2 face="sans-serif">Manoj Kumar Sharma</font>