title: Pagination in servlet and JSP
body: <p>I am doing pagination and I followed <a href="http://theopentutorials.com/examples/java-ee/jsp/pagination-in-servlet-and-jsp/" rel="nofollow">this link</a> and it works!</p>
  
  <p>However, I am facing problem with indexing. I am fetching large amount of data and total number of pages are around 100.</p>
  
  <p>All the page numbers are displaying in main jsp page itself. It means 1 2 3 4 5 6 7 8 ----- 97 98 99 100 Next.</p>
  
  <p>But i want to display 1 2 3 4 5 6 7 8 9 10 then next.</p>
  
  <p>So can anyone please suggest how can I implement this method instead? Thanks in advance! :)</p>
  
  <pre><code>&lt;c:forEach begin="1" end="${noOfPages}" var="i"&gt;
  &lt;c:choose&gt;
  &lt;c:when test="${currentPage eq i}"&gt;
  &lt;button type="button" onclick="location.href='...?page=${i}';"&gt;${i}&lt;/button&gt;
  &lt;/c:when&gt;                                       &lt;c:otherwise&gt;
                                                      &lt;button type="button" onclick="location.href='...?page=${i}';"&gt;${i}&lt;/button&gt;
  &lt;/c:otherwise&gt;
  &lt;/c:forEach&gt;
  </code></pre>