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.
This is a excellent web site, might you be interested in doing an interview about just how you designed it? If so e-mail me!
gioco della roulette scaricare
Feel free to surf to my blog; casino Con 5 euro Di ricarica
american roulette
My web site … giri Gratis senza deposito
siti per giocare online Matematica Del Gioco D’azzardo
betting exchange news
Here is my webpage – online bookmakers
betting euro
Look at my blog post: Bookmaker Training
Best Betting Exchange For Matched Betting online paypal
giochi slot sicuri
Also visit my web page :: migliori siti per giocare alla roulette (Shawna)
boa esporte bola de Ouro sistema de Apostas
futsal How to Win at betting (https://masoomcare.co.uk/a-guide-to-promotions-understanding-wagering-requirements/)
gioco alla ruota della fortuna
Also visit my blog … casino che accettano pago efectivo (Minna)
betting on sports with bitcoin sites that take paypal
best bookies and Most Profitable Betting Markets (Emilka.Ovh) sites
virtual sport No limit betting sites
newcastle bournemouth welcome bonus no deposit betting (https://Www.Arzt-Playademuro.com/2026/07/22/how-seasonal-sports-shape-betting-promo-availability/) tips
bookie betting app eurovision odds
cheltenham festival spread betting technical analysis (https://www.unionforproject.com/2026/04/04/understanding-line-movement-in-sports-Betting/) tips
baugenehmigung wettbüro
my page … wetten Basketball em
stoke betting Companies
odds
Virtual Sports Betting Strategy shop gift cards
esport best sports betting app tips
good best Australian open betting site websites
top online sportsbooks
Also visit my web page :: Betting Trebles
serious value betting strategy (Winnie) sites
casino con paysafecard 5 euro euro di
ricarica
nuove norme per le slot machine
Feel free to visit my web page cardano casino bonus Senza deposito
Place Betting (Misericordiasancasciano.It) sites crypto
slots senza scaricare
Here is my homepage … come si fa burraco; https://Dev5.myvtd.site,
cheltenham festival 2026 betting tips
My web blog Exacta Key Box Bet
premi bingo
Review my web-site … Tattica Per Giocare Alla Roulette
sportsbooks online
Take a look at my homepage :: Betting Bonus Comparison
esports betting with bitcoin exchange commission rates
betting companies ireland
Take a look at my website: best masters sportsbooks (Kasha)
cavalos apostando corrida
Here is my blog: casas de apostas com melhores odds
gioco d’azzardo in europa
My web-site codice benvenuto casino top – Skye -
come funziona un casinò online
Review my webpage: burraco 3 contro 3 (Paul)
pagar Impuestos por apuestas de boxeo canelo
Come contare le carte al casinò vincere al
baccarat online
massima puntata roulette
Also visit my webpage; regola chemin de fer (Dannie)
gioco d’azzardo italiana
Feel free to surf to my web-site – la slot machine casino;
Christine,
partecipare ruota della fortuna
Here is my blog post roulette puntare su tutti i Numeri
giocate vincenti alla roulette
Here is my site Casino che accettano Payoneer
casas casa de aposta com bônus sem depósito apostas limite
ios
gekaufte spiele basketball wetten über unter verlängerung
conto delle carte blackjack
Here is my web-site :: app slot che pagano (https://Actionproslegal.hostpapadesign.com/come-si-fa-a-puntare-al-blackjack-su-android/)
bingo di mugnano
Here is my web-site; Previsione numeri Roulette
bonus ved tilmelding betting
Here is my blog: Sammenlign Bookmakere
basketball über unter wetten Overtime [farmaregistroint.com] halbzeit
endstand
mastercard casino nederland online
my website :: bingo brugge – Shanel -
regole gioco dadi
my website bingo a foggia