0

Now I have a resultset that has a 1,000+ number of rows, and I am placing all the values of the resultset in a table. The problem now is that the table is so long so I want to divide it by 100 and store the other 100 in the next page. How can I do it?

This is my codes right now

This is my codes right now This is my codes right now

<div class="TableDesign" >
<table align="center">
<thead>
    <tr>
        <th>Word 1</th>
        <th>Word 2</th>
    </tr>
</thead>
<tbody>
    <%while(resultset.next()){ %>
    <tr>
        <td>
        <%= resultset.getString(2) %>
        </td>
        <td>
        <%= resultset.getString(3) %>
        </td>
    <%} %>
</tbody>
wohooooo
  • 23
  • 1
  • 1
  • 7
  • would giving the div.TableDesign a height and overflow scroll work for you? – Aaron Mar 06 '15 at 14:48
  • You would need script for this. Look into jquery or javascript pagination plugins – Sai Mar 06 '15 at 14:52
  • 1
    http://www.datatables.net/ look into this . it may help with what your need is. – Sai Mar 06 '15 at 14:57
  • @Aaron if it looks well maybe it would, cause my resultset returns 1,167 rows – wohooooo Mar 06 '15 at 14:58
  • You could add the page number as parameter and add links to the other pages. See [How to get parameters from the URL with JSP](http://stackoverflow.com/q/1890438/2991525). (writing the right parts of `resultset` (or changing the query to include only the correct part) should be trivial.) With the javascript approach however, you don't have to reload the page. – fabian Mar 06 '15 at 15:03
  • Thanks @Sai currently digging into it, it has all i need a paginated table and a search query – wohooooo Mar 06 '15 at 15:08
  • Use this which will give you (client-side) pagination easily. You can then plugin your own server side pagination if you wish: http://www.displaytag.org/1.2/ – Alan Hay Mar 06 '15 at 15:54
  • You could also look into Dandelion Tables http://dandelion.github.io/datatables/ which is based on jQuery DataTables . You can just use Dandelion based JSP Taglibs to get the required functionality. Refer the link for more details – Sai Upadhyayula Mar 08 '15 at 19:14

0 Answers0