Auto-paging of long lists

120 items found, displaying 61 to 70.[First/Prev] 3, 4, 5, 6, 7, 8, 9, 10 [Next/Last]
ID Name Email Status
37233 Vero Tempor vero-tempor@kasd.com ELITR
32368 No Et no-et@gubergren.com IPSUM
93585 Accusam Dolore accusam-dolore@sea.com SED
82067 Diam Voluptua diam-voluptua@no.com KASD
14622 Eirmod Ipsum eirmod-ipsum@et.com ACCUSAM
63684 Consetetur Dolores consetetur-dolores@clita.com ALIQUYAM
19814 Sit Eos sit-eos@magna.com KASD
8763 Invidunt Dolores invidunt-dolores@sadipscing.com VOLUPTUA
12872 Vero Eirmod vero-eirmod@voluptua.com SED
27270 Sed Invidunt sed-invidunt@vero.com NO

Ok, you have made a query that returns you back a list of 120 elements, but you don't want to show the user all 120 items at once, you want to allow them to page through the results (pretend 120 is really 1200 or 12000).

One of the most common web UI techniques is to show a page of data (items 1-10), and then let the user click on a page number and allow them to scroll through the list. Include the "pagesize" attribute to your table tag, and the tag takes care of the reset.

You need to design your page, so that the JSP page with the table tag can be reloaded without reloading the entire list of entries. It is assumed that you have gone through the action of loading the list in a previous page (or action in Struts-speak), and then redirected the person to the page with the table tag on it.

You need to do this because the table tag's various page links will all point to the page the table tag is on (but also providing various parameters - which the table tag itself parses and deals with). So if you are doing any processing on the page, it can either 1) simply not work because the table tag doesn't know what parameters to pass for your processing, or 2) slow things down because you would be reloading the entire list on each page, rather then just showing a subset of the list. It sounds confusing, but that's just because I do a poor job of explaining it...

By default, the table tag tries to figure out what the URL is for the page it is on by calling the request.getRequestURI() method, but this will not always return a correct answer in environment where you are forwarding a request around before arriving at the JSP that is to be displayed (like struts). In those cases, you need to tell the table tag what it's URL is via the "requestURI" attribute.

All the parameters received in the first request are preserved in paging. You can exclude specific parameters using the "excludedParams" table attribute.