Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to correctly invoke the doPagination FreeMaker macro

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to make sure the the doPagination FreeMaker macro to support paginating long list of records. However, I couldn't get it right. The following is its source declared in pagination.ftl file:



What does the id parameter of the macro refer to?

Could anyone kindly explain it to me?

Thanks in advance,
Michael Wu
[originally posted on jforum.net by michaelwu]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any kind of ID - a category's ID, a forum id etc..

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally figured it out. Well, although it is declared as one of the call arguments of pagination macro, it is actually optional. If it is not given, a default value of -1 is assumed. Whether it is given or not will affect the way the paging urls are derived. If not given, the derived paging url carries one parameter. If given, the derived paging url carries two parameters. The meaning of these parameters are determined by a corresponding property declared in the urlPattern.properties file. It provides the hint for the action implementation classes to retrieve the parameter values when the user clicks on the derived paging url.

For example, the property in the urlPattern.properties file:
#added by myself
adminLogs.list.1 = log_id

indicates that the paging url http://.../adminLogs/list/25.page carries one parameter - 25. It can be retrieved with the statement request.getParameter("log_id");

In my action implementation class, I thus know which log records should be listed.

This is what I learned from the works in the past two days.

Thanks,
Michael Wu
[originally posted on jforum.net by michaelwu]
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic