• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to correctly invoke the doPagination FreeMaker macro

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic