Defining a strategy for splitting book lists without SQL

I have ArrayListof Book, extracted from different Merchantand sorted in Java, depending on user preferences, depending on price or customer reviews:

List<Book> books = new ArrayList<Book>();

This requires me to store a large chunk of data in memory, stored as Java objects at all times. Now that I need to break this data down into lists that span multiple web pages and allow the user to click on a numbered page link to go to that data segment, what is the best way to do this?

My idea was to have 25 lists of books per page and instead of using hyperlinks that transmit form data as a request GETfor URL parameters, hyperlinks to the page number simply re-enter the form , passing the requested page number as an additional parameter POST.

<input type="hidden" id="pageNumber" value="0">
<a href="#" onClick="pageNumber=5; this.form.submit()">Page 5</a>

In this case, page 5 will be just a collection of 25 entries, starting from the 125th (5 * 25) ArrayListentry in and ending at the 149th entry in ArrayList.

Is there a better way to do this?

0
source share
4 answers

Application refactoring, for example, Hibernate retrieves data from a base database.

Hibernate .

+3

IMO, , GET POST, , , , ( RESTful rebuttals). , , . , , , , . , .

+1

? ( )? () ?

, 25 , () 200 JSON javascript n.. n + 24 . , . 1x1.gif? User = u1 & action = , ( ..) .

, , , JSON , html, ,

  • , ( )

, , . , , 26-50.

, 500 , 3. . - , , , . .

+1

- Java. :

http://www.hdpagination.org

This may be an option for you.

If you have any questions, feel free to ask.

0
source

Source: https://habr.com/ru/post/1764754/


All Articles