D
D
DunkanMaklaut2020-07-31 08:03:18
Java
DunkanMaklaut, 2020-07-31 08:03:18

How can I implement pagination of table records?

Hello, I am faced with the task of paginating table records. How it looks now: an ArrayList of Employer classes is passed from the servlet (which contains the fields ID, Command, Name, etc.), the c: forEach loop displays the final table of 1500 rows ... Each row has a Delete button, and a link to editing by clicking on the ID of a specific person. As well as the add button and search fields for the table (a request is sent to the database via a servlet

) as in an online store: display 10 (20 or 30) lines and scatter the rest over the remaining pages. If it is possible, then so as not to overhaul it all, because it will take too much time ...
UPD1: I mean, are there ready-made libraries for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2020-07-31
@DunkanMaklaut

Hello!
The first option is to connect datatables.
It supports the following types of pagination:
1) pagination on the client, when it gives you 1500 lines, but scatters over pages (for example, 100 elements each)
2) server pagination, when it sends a request to the server and gets the corresponding page.
https://datatables.net/
Another solution - for example, if you have a spring application, then there is a Pageable object.
https://www.baeldung.com/spring-data-jpa-paginatio...
https://www.petrikainulainen.net/programming/sprin...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question