Programming Thoughts
J2EE - Pagination
Results Sorting Example

Displaying search results in pages

The previous article described a Template class, list cache, that aids pagination of search results with post query results sorting. This article describes a working example for download. It is similar to Example 4 but the user can sort games by clicking on a column header.

Note that column sorting without first applying a more restrictive search is slow as it must eager load the entire table that's supposed to be lazy loaded. This shows the importance of managing user expectations so users don't request conflicting features.

Live example

A demonstration application can be accessed here. The start page looks like the following.

Figure 1: Starting page

Download

Source code of a demonstration application can be downloaded here as a zip file. It requires the following.

  • JDK 8 or better
  • Maven 3
  • Jakarta EE server, such as Tomcat 9

It compiles into a WAR file and is run from the /example5 URL page. The start page looks like the following.

Figure 1: Starting page

The application searches the games from a 2021 copy of the Board Game Geek database. Credit to Jen Wadkins at Kaggle for compiling the dataset files.