A small demo app showing some features of Spring Boot for handling a Thymeleaf template, a JSON request, using Spring JdbcTemplate, with some Java records, lambdas and streams. The demo uses a server-side DataTable for the demo. Not intended for production use.

Source code is available here on GitHub.

The data source is a MySQL table:

The running application serves a DataTable similar to this one from the official documentation.

It runs at http://localhost:8080/demo/listing

The Java record ServerSideRequest represents the automatically-generated request sent from DataTables to the server upon a change event - e.g when the user performs a sort, search or page change.

The Java record ResponseContainer contains the response sent back from the server to DataTables for each request.

Most of the work to build the page of data to be displayed is handled by the EmployeeService class. This implements the required sorting, filtering and pagination logic.

In my simple demo, I always fetch all rows from the source relational table, and then perform all processing in Java. In a more realistic production scenario, I would not do this, for obvious reasons - but for this demo, it’s not a problem.

Collation and normalization rules are used allow words with diacritics to be searched and sorted alongside words without diacritics. For example, Édouard is sorted alongside Edward; and a search for ed or éd will find both of these names.

Still to do: The test data set contains no null/empty values. Some additional handling would be needed for these.