I couldn’t find a good set of macros to help navigate through paginated data so I wrote my own. The macro names echo the names of the CakePHP PaginationHelper functions because…well, they’re reasonably sensible.
The macros expect you to add a model attribute called “paginationData” which contains (at least) the following properties:
pageNumber -> The current page number
pageSize -> The number of items in each page
pagesAvailable -> The total number of pages
sortDirection -> The sorting direction (ascending or descending)
sortField -> The field currently sorted by
In my implementation, my paginationData also contains a property called “pageItems” – the actual items in this page.
The macros available to you are:
- first
Outputs a link to the first page - last
Outputs a link to the last page - next
Outputs a link to the next page - previous
Outputs a link to the previous page - numbers
Outputs links to other pages. The macro takes a parameter called “maxPages”, which is the maximum number of pages that should be output. There is also a second parameter “separator”, which is the text/html that should be output between each page link. - page
Outputs a link to a particular page. It takes the page number and link text as parameters. If you omit the link text it’ll default to the page number - counter
Outputs the current page number and the total pages e.g. “1 of 20″ - sort
Outputs a link to sort by a field. Takes the field to sort by as its first parameter. If field is different to the current sort field, the link will change the sort field but not the sort direction. If the field is the same as the current sort field, the link will change the sort direction. The second parameter is the link text, which defaults to the field name with an upper case first letter. It also takes a parameter called “directions”. This is an an array of two items: the words being used in paginationData.sortDirection to describe the sorting direction of ascending or descending. Default: ["Asc", "Desc"]. So it can compare the current sorting direction and switch to the converse.
Note, ordinarily you’ll probably not need to use the “page” macro.
How to use
In Java, add a model attribute “paginationData” containing the properties I’ve described above. Then, in your view, import the library:
<#import "pagination.ftl" as pagination />
Call the macros:
<nav style="float:right;">
<@pagination.first />
<@pagination.previous />
<@pagination.numbers />
<@pagination.next />
<@pagination.last />
</nav>
<@pagination.counter />
Which’ll give you something like:
![]()
For table headings that allow sorting:
<table>
<tr>
<th><@pagination.sort "forename" /></th>
<th><@pagination.sort "surname" /></th>
<th><@pagination.sort "email" /></th>
<th><@pagination.sort "created" "Registration date" /></th>
</tr>
...
</table>
Download
You can download the pagination macros here.
juegos de Casino tragamonedas gratis demo en chipiona
sicher sichere basketball wetten (https://Basketball-Wetten.com) gewinnen
beste wedden sites legit wedden sport
bukmacher zarabianie
Here is my site forum bukmacherskie siatkóWka – https://bukmacherjakie.com -
paying tax on gambling winnings canada, best online poker app new
zealand and poker for real money in usa, or online payout casino online (Dexter) not in uk
casino de algorta con bonus gratis
wedden paardenrennen online
My web-site sportweddenschappen fifa 2026
(Trisha)
descargar casinos con maquinas tragamonedas gratis
Here is my page – online casino license curacao (Cesar)
juegos para ganar en el Casino online de
casino gratis con bonus sin descargar
sportwetten willkommensbonus ohne einzahlung
Also visit my web blog: Online Wetten Mit Paysafecard
casino de tirgre (https://Salvatechacademy.com/2026/01/06/descargar-juegos-de-spins-gratis-para-pc-en-espanol/) real de las palmas
tiradas gratis españa casino, Cole, solvay dombasle
app gran Casino costa meloneras dinero real iphone
Pianeta scommesse Quote, sisal
goodwood best aintree betting offers – Laurence, odds
Cuál es el mejor casino online para jugar, Ruivende.Com.br, gratis y sin descargar
mejor juego para jugar en casino online, https://laurenbbooks.com/, de casino gladiador
Declarar Premios Casino cartas jugar
ruleta juegos de casino cuando ganan – Alisia – online demo
casinos gratis sin deposito
Feel free to visit my web site: casino online para jugar Desde españA
Casino Villajoyosa online
que acepta paypal
el Casino Gratis Para Celulares vilafranca
formas maquinas de los casinos [https://Miflorespc.com/prefieres-jugar-al-blackjack-en-espanol/]
ganar en el casino
juegos de maquinitas de casinos en vigo
how much is a £5 trifecta box bet
My homepage :: online greyhound betting sites (Stan)
casino bonus sans depot retirable
my web blog: casinos online mas famosos
https://www.equinenow.com/farm/lost1587.htm
https://www.equinenow.com/farm/lost1587.htm
https://www.equinenow.com/farm/lost1587.htm
apuestas tercera division (Claudette) futbol argentina
welche online casinos gibt es
Feel free to visit my blog post – blackjack ohne einsatzlimit [degambling.de]
esporte aposta online
Also visit my website :: bônus das casas de apostas iniciantes; Silke,
maquinas Juegos De Casinos Gratis Sin Descargar Maquinas Nuevas los casinos
casino barcelona online codigo promocional (Polskiklubmtb.pl) cartas
como jugar
el mejor Minijuegos Casino Online – Https://Kristus.8U.Cz/?P=21467, para jugar
que significa asiatico en Apuestas 10 euros gratis
casino en pucon españa
Here is my website casinos online con licencia (https://Eneca.Org.rs/)
juegos juegas de casino (Benjamin)
casino 21
casino con bonus primo deposito
my page: juegos de maquinas de Casinos para jugar gratis
sites Legais de apostas para domingo
descargar juegos de casino gratis bienvenida (Angelina) online gratis
juegos que puedes ganar dinero casino online (Jerri) prado sitges cartelera
juegos en lineas de casino (Daniella) de casino con bono de bienvenida
casinos de puerto banus
Take a look at my blog post; bono casino para usuarios registrados
formula 1 e-naar online wedden sites
como funcionan Foro Apuestas Nba multiples
20 giros gratis novibet casino
Also visit my page: casinos de la costa (https://dotkom.com.br)
casino ciudad trigal
Here is my website: casinos en Todo españa – saluttextil.com -
jugar blackjack 21 online casino blackjack real Money
jugar a juegos y ganar dinero casino online online deposito gratis