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?
source
share