FreeMarker pagination macros

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.

702 thoughts on “FreeMarker pagination macros

  1. These are the cross – which destroys symbols in a vertical and horizontal line – a Horizontal Destroyer, 3-row slot with 10 flashing win lines and having certain symbols become animated when theyre part of a win as well. Based on all of the information mentioned in this review, you can be sure that any Intouch Games slot is fair to the player and to the casino on which it appears. Cluster Symbols: From which the slots name derives, this cool feature is triggered every time you land a successful cluster of symbols. They will be frozen in place and you’ll be awarded a re-spin. If in this spin, you add to the cluster, they will also be held in place and you’ll get another re-spin. If you manage to add another to the cluster, again you’ll be granted a re-spin again. The re-spins will keep on coming as long as the cluster is added to, during the spin, and this, of course, can lead to momentous coin rewards and fill the reels.
    https://napkolkata.co.in/ripper-casino-banking-details-what-australian-users-need-to-know/
    This strategy is primarily intended for even money bets, to add a unit on every damage and get a new unit for every win. Some players call this a new “parley” in buy not to give Mr. Paroli or the card game and also the pizzeria credit in this ingenious system. This could be the “ah-ha” moment regarding you as an individual might have parlayed some of your bets in typically the past. If you play in a casino where the home allows surrender or perhaps en prison in even-money bets, your even-money play will probably be that much better considering that the house is definitely taking a smaller reduce. Every time an individual win a bet, you cancel typically the first and previous numbers, thus giving a person 2, 3, 5, 5. The standout element of this roulette game is that it beautifully combines elements of roulette with game show-style titles, giving players the very best of both worlds. The classic and simple design creates an atmospheric feel, giving players a real-life, immersive online casino experience.

  2. There are 3 to 7 rows on the 5 reels here so 243-16807 ways to win on Super Hot Fruits Megaways slot. Symbols can appear single and stacked with no Wilds or scatters in the basic game but you do get both-way pays. The Crown is best for 5-of-a-kind at 32x bet then 2.5x Red 7′s, 1.5x Blue 7′s, 0.75x Bell or Melon then five lower fruits paying 0.6 or 0.5x for each full way. So with no Wilds, randoms or scatters, what does this slot actually do? Players can activate the Ante Bet to increase their stake slightly, boosting the chances of triggering the Free Spins round. This feature is perfect for thrill-seekers who don’t want to wait for the big bonus. Fire Joker is a Classic 3-Reel slot with 5 paylines from Play’n GO. Winning combinations can be formed by landing 3 matching symbols, from left to right, across a win line.
    https://sesammarket.com/2026/03/16/maximize-wins-with-bet-saver-katsubet-casino-in-new-zealand/
    The features are Diamond Meter, Coin Meter, Super Stake, Bonus Wheel, Free Spins, and Bonus Buy. Devsort, a leading IT support company based in United States, pioneers excellence in IT services. From comprehensive IT support to cutting-edge solutions in data science, computer vision, NLP, ML, QA, software testing, and signal processing, we empower businesses to thrive digitally. Game play volatility is actually classified while the extremely high, and this adds stress and you can exposure, remaining your to the edge of your own seat. There are no crazy bonus Wilds or scatters you to activate at random and leave your feeling confused about what merely occurred. We during the AboutSlots commonly responsible for any loss from betting inside the gambling enterprises regarding any of our extra also provides. The ball player is in charge of just how much anyone are willing and able to play for. Practical Gamble’s Grasp Joker casino slot games provides you with the capacity to perform that.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>