PagesDialect for Thymeleaf

PagesDialect is a custom dialect for the Thymeleaf template engine. It provides some Collection processing utilities, like pagination, sorting or exporting.

Note: these utilities work with the full Collection object in memory. This could be not a good idea if you have a table with thousands of rows, but it is pretty nice for a bunch of simple applications, or if you are using a server cache or any kind of lazy-loading.

Dialect processors

Processor Parameters Description Example
pages:paginate Results per page (could be an expression) Transform th:each iteration to add pagination.
It generates page navigation links (first, previous, next, last) and show the current page, total number of pages and total number of results.
Example usage
pages:sort Field to sort by. Could be a dot expression, as "category.name" Add sort links to a table headers. Example usage
pages:separate Results among separators (could be an expression) Insert a separator tag after n iterations.
pages:pdf Fields to export, separated by commas. Could be dot expressions, as "category.name".
Also supports header labels appending to a field a colon (":") and a i18n key.
Export iteration list in PDF format. Example usage
pages:excel Fields to export, separated by commas. Could be dot expressions, as "category.name".
Also supports header labels appending to a field a colon (":") and a i18n key.
Export iteration list in XLS format. Example usage

Installation and configuration

Version numbers: 2.0.x versions are compatible with Thymeleaf 2.0.x versions, while 2.1.x versions are compatible with Thymeleaf 2.1.x versions.

Demo

If you want to see PagesDialect in action, you could download pagesdialect.war demo application and deploy it to a Servlet 3.0 container.

Support and docs