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.

2,452 thoughts on “FreeMarker pagination macros

  1. It’s an unofficial (modified) version of the Alight Motion Mod apk. People use it to unlock paid features for free. It’s not made or supported by the Alight Motion team. The Alight Motion is the pinnacle of fun in terms of usage, which is simple, straightforward, and smooth. Its interactive UI, authoritative controls, and friendly usage serve as the gleam of light that helps add flair to your edited videos and images. But there are some expert tips in our dedicated How to Use Alight Motion blog that can help you take your in-app journey to the next level. Some of the tips are stated in the below section. So, let’s explore them. The reason why Alight Motion Mod is unique among all competing video editors is that it contains lots of professional enhancing tools. If you are a social media content maker or you love making videos, then, this application has got all the tools to make your videos look stunning. From clear sound and clear pictures and animation, her good quality content is enjoyed by both novices and experienced ones. Alight Motion Mod APK can be easily used on iOS Android and PC.
    https://www.ideaa.co.il/itpirots-free-spins-recensione-della-slot-pirots-di-elk-studios-2/
    Although with CapCut you normally create projects from scratch, the program also has a very interesting feature that allows you to generate several short videos, in vertical format and with subtitles, from a single long video. This feature is particularly interesting if you regularly stream for long periods or take long videos and want to share the best clips on social media. With this specialized tool, you can create these clips in seconds. Just look over all the finished work, and that’s it. One of the key elements of video editing app development like Capcut is how easy the app makes it to create videos with its user-friendly templates. Creators can easily put clips in these templates with customizable animations, color schemes, transitions, and soundtracks. This is one of the features that immensely expedites the creators’ time.

  2. Importantly, Edits does not apply a watermark or force you to pay to remove it. Nor does it only allow you to share your video to Instagram profile. This means it’s a versatile tool that you can use for videos for a range of social media sites. This app has been a long time favorite of mine. Never glitches and is fast at uploading a lot of videos. Super reliable. I love making my reels through this app and home videos set to music. Must have for me. All the power of a desktop video editor—in the palm of your hand. When professional content creators and influencers need their videos to stand out on social media, they rely on Splice. Another excellent free video editor app for iPad and iPhone (there’s an Android version, too) is Videoshop. The app has a wide range of features, including options to trim, merge, transition, and resize videos, add voiceovers and animated titles, add music, layer videos, and much more. It’s easy and intuitive to use but is only compatible with videos created on iPhone or iPad. You can upgrade to an Unlimited subscription for access to all features and content. A subscription is cheap and starts at $3.99 per month or $23.99 per year. You can also pay to remove watermarks from videos, which costs $2.99.
    https://hedgedoc.uni-ak.ac.at/s/GjBueYrYue
    I think one of Animaker’s best benefits is their super useful support. They responded very promptly whenever I tackled an issue or had a question. I never had to wait too long. The generation model of the animated video is currently being optimized and trained. As you can see, all the animated family photos above are great. And there are still tons of styles to explore, so you can bring each photo to life in its own unique way. Not to mention, Filmora’s AI Image to Video feature is also available on Filmora mobile, so you can animate your family photos anytime, anywhere. Jump into real-time face mocap at any budget. Choose between the availability of webcams or the advanced TrueDepth tracking on the iPhone. Different mocap profiles are also accessible for different personas. Drag & drop to upload your images

  3. VN stands as a user-friendly and watermark-free video editing app that has made the art of video editing accessible to everyone. Its interface is so intuitive that even beginners can engage in professional-level video editing without any prior knowledge or experience. If you’re into video editing and want to use a video editing program, selecting one will be intimidating, mainly if you know the features you need in your program. As a content creator or a social media influencer, when you need to edit videos, you need a program to make the operation quick. It would be best to have a program that can execute various functionalities simultaneously, such as the VN video editing program. VN Video Editor is a free, professional-quality video editing app available on Android, iOS, macOS, and Windows. It offers powerful tools like multi-layer editing, keyframe animation, green screen, transitions, and more. You don’t need editing experience to use it — the app has a clean and user-friendly design that helps you edit faster and smarter.
    http://arahn.100webspace.net/profile.php?mode=viewprofile&u=247087
    Regarding video editing, Adobe’s Premiere Rush is a testament to the magic of editing apps. This scaled-down version of Premiere Pro offers a remarkable blend of user-friendliness and professional-grade capabilities, making it a top choice for beginners and seasoned video editors.  Clipchamp comes with all of the features required to create great videos – no experience needed. Get started with recording tools or choose professional video templates to make an eye-catching video in our online video editor. Peachy also provides basic photo editing tools such as cropping and adjusting brightness, contrast, and sharpness. With its powerful face and body editor features, Peachy helps you perfect your selfies and portraits like a pro. You can easily share your edited photos on social media platforms like Instagram, Snapchat, WhatsApp, and Facebook.

  4. Access to free video editing software without watermarks is crucial for creating professional-looking videos. We’ve explored the top 10 options available, each with unique features and benefits for beginners and experienced editors alike. Whether you’re a content creator, social media enthusiast, or someone looking to enhance your videos, explore these free options and unleash your creativity. Get creative and show your passion with our free video editor. Works as a meme generator, YouTube video editor, GIF maker, TikTok video editor, slideshow maker, GoPro video editor, and more. Now it’s time to remove the distractive logos or watermarks from your video clip. To do that, click the Remove Watermark tab and then top the Select Area button. After that, adjust the cropper by dragging it to cover the video section with a logo or watermark. Finish up by selecting a folder path on File Location and then press Remove Watermark to process your non-watermarked video.
    https://www.bluefinchmedical.com/?p=115178
    As a journalist, I, William Hollingworth, strive to capture stories, uncovering hidden truths behind the obvious. Even in serene narratives, like the thrilling game Big Bass Bonanza, there’s always depth waiting to be revealed. For me, words are a tool to shine a light on the truth and leave a mark on history. Online casinos and the iGaming industry at large have been responsibly regulated by trusted bodies for decades, with the UKGC and MGA being the leading organisations in this regard. Betfair Casino seeks to go above and beyond the mandate of its regulator (Malta Gaming Authority – Europe’s primary iGaming regulator), paying extra attention to guarantee the security and privacy of all players. Virgin Games is operated by Gamesys Operations Limited of Suite 2, Floor 4, Waterport Place, Gibraltar, GX11 1AA. Contact Us

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>