user3592257
user3592257

Reputation: 105

How to implement pagination using Spring MVC3

I have requirement to implement pagination using Spring MVC 3. I am getting list of 1000 numbers from a Web Service. Now i want to show 5 nos. at a time and when user go to next page then 5 nos and so on. Someone please give me some pointers on this.

Upvotes: 0

Views: 1631

Answers (2)

sathish_at_madison
sathish_at_madison

Reputation: 833

You can use the PagedListHolder api.

Similar question is answered check this link.

This previous link can solve the right away. From GitHub there are new API's that are springing to solve this issue. There is a spring framework tailored pagination, you can take look at some of the links

spring pagination

Upvotes: 1

Paul Croarkin
Paul Croarkin

Reputation: 14675

This is not specific to Spring MVC, but will work with Spring MVC. DataTables is a jQuery plugin that nicely formats tabulated data and provides configurable paging out of the box.

Add the following to your JSP:

<script type="text/javascript" src="<c:url value='/resources/DataTables/media/js/jquery.dataTables.min.js'/>"></script>

...

$(document).ready(function() {
    $('#myTable').dataTable();
});

Make sure that your table uses thead and tbody tags on your table.

Upvotes: 0

Related Questions