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 la frutillita de casino azar
migliori casinò ca’ noghera recensioni online non aams
dogecoin casino bonus bez vkladu vklad od 1 kč
https://pad.funkwhale.audio/s/WBB6VjgeD
https://pad.funkwhale.audio/s/WBB6VjgeD
https://pad.funkwhale.audio/s/WBB6VjgeD
casino online sin dinero
Also visit my blog post … casinos en valdepeñas
https://app.brancher.ai/user/mmFZcjXGgjkE
https://app.brancher.ai/user/mmFZcjXGgjkE
casinos sin deposito inicial 2026
Have a look at my web blog :: casino san pedro del pinatar
https://app.brancher.ai/user/mmFZcjXGgjkE
lehečka tenis dnes
my website: americká liga Fotbal (stanislavpechacek.com)
https://reactormag.com/members/madelyn541/profile/
https://reactormag.com/members/madelyn541/profile/
https://reactormag.com/members/madelyn541/profile/
kasyno darmowe spiny na start
My blog :: Gry Kasynowe login
https://793657.8b.io/
le carte
my web blog: Schema roulette francese
Jugar dino casino gratis proche gandia
https://mirfali.com/author/effectiverte10/
https://mirfali.com/author/effectiverte10/
https://793657.8b.io/
bonus powitalny pieniądze bez wpłaty kasyno [https://Www.Davepullan.Co.uk] paypal
bono trading sin depósito 2026 Casino online bono por registro sin deposito online
https://793657.8b.io/
https://793657.8b.io/
polskie kasyno online z Automatami
mastercard
casinò locarno recensioni
Also visit my web-site … il baccarat gioco
http://andreas-dominic.org/author/collgr503/
kasyno online wpłata xrp
Here is my site :: najlepsze ruletka z bonusem
http://andreas-dominic.org/author/collgr503/
100 juegos gratis para jugar grand casino Luzern (https://Domsociety.ro/)
http://andreas-dominic.org/author/collgr503/
https://huckerreport.com/author/lyricsdyk1004/
numeri tombola romana
Visit my page – ogni Quanto esce un numero alla roulette
https://profile.sampo.ru/madelyn541
https://huckerreport.com/author/lyricsdyk1004/
roulette formula
My web-site … giochi per vincere soldi (https://www.ediliziastradalegr.it/)
https://huckerreport.com/author/lyricsdyk1004/
https://reduser.net/members/madelyn541.241630/#about
numeri gioco d’azzardo e probabilità (Https://chemimed.com/come-si-gioca-al-blackjack-digitale-nel-2026/)
colori della roulette
najlepsze kasyno online opolskie (Breanna) na telefonie
juegos de Casino 7 gratis de casino que tengan bonus
http://hurricanesurf.net/author/sistericb19/
https://reduser.net/members/madelyn541.241630/#about
http://hurricanesurf.net/author/sistericb19/
http://hurricanesurf.net/author/sistericb19/
https://fora.babinet.cz/profile.php?section=personality&id=150750
https://fora.babinet.cz/profile.php?section=personality&id=150750
http://riotstories.co.uk/author/streampra888/