Pagination in spring mvc

2019-09-21 20:41发布

问题:

My question is how to give page number in jsp ex: if I have the list size is 30 on db but I want to display only 10 in page one, how to display 1 2 3 number in jsp , 30 /3,

回答1:

You can use DataTable for displaying data:

The Javascript shown below is used to initialise the table shown in this example:

$(document).ready(function() {
    $('#example').DataTable();
} );

In addition to the above code, the following Javascript library files are loaded for use in this example:

//code.jquery.com/jquery-1.12.4.js
https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js
https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js