1. DisplayTag
  2. DISPL-122

Increase efficiency paging using a subset (patch included)


    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.0 RC2
    • Fix Version/s: 1.1
    • Component/s: Paging/Sorting
    • Labels:


      imported from sf tracker
      id 1013526
      submitted by Will Glass-Husain - wglass

       [This really belongs in issue#872183 but I couldn't figure
      out how to add another file to the issue.]

      The dilemma - how to efficiently display a large list (e.g.
      20,000 rows) one page at a time. Currently, to take
      advantage of DisplayTag's paging features, you must
      generate the entire list each request.

      This patch allows the application to control the
      selection of the specific sublist, with DisplayTag
      automatically generating the PREV/NEXT links as usual.
      For an MVC environment pulling large lists out of a
      database this can be used to implement significant
      performance improvements.

      There's already a patch solving the same problem in the
      issue tracker (#872183), but I've made an alternate
      implementation (not having seen the first proposal at
      the time). This particular patch may be easier to
      integrate than the previous one (being based on a more
      recent version of DisplayTag). It is fully backwards
      compatible, works with EL tags, and is configurable with
      DisplayTag properties rather than any new attributes.

      Using it is not too complicated, although it requires
      coordination between the Controller code and the JSP
      page. There are two new DisplayTag properties:

      paging.manual (true/false, default: false)
      paging.manual.prefix (default "d")

      In order to produce a table, the controller must
      generate the sublist, calculate the size of the full list,
      and pass both pieces of info to DisplayTag. (both are
      required for paging). The size of the full list is passed
      by setting a pageContext attribute with the name of "d-
      size". (or X-size, if X is the prefix specified with
      the "paging.manual.prefix" property). DisplayTag will
      display the sublist amd will also generate page hyperlinks
      for the full list. Each hyperlink will contain a request
      parameter "d-p", e.g. "d-p=2". (This is similar to the
      standard page parameter which is typically something
      like "d-2911-p=2"). When the hyperlink is clicked, the
      controller should note the new page number and send
      along a new sublist.

      Example pseudo code:


      int pagesize = 10;
      int fulllistsize = <count the size of the full list>
      List sublist = <generate sublist for the particular page,
      based on a page size of 10>

      JSP PAGE:

      <display:table name="${list}" pagesize="10">
      <display:setProperty name="paging.manual"
      value="false" />

      .. all the display columns

      A key issue the patch had to address is how to
      distinguish one TableTag from another if there are
      multiple instances on the same page. This is normally
      done with an automatically generated id. In this case
      however, since the request parameters must be
      recognized by the controller to generate the sublist, the
      id is skipped and the prefix (specified in the properties)
      is used instead. Thus it is up to the page designer to
      use different prefixes for different DisplayTag tables on
      the same page.

      I'd welcome any comments.

      Note: this patch was made against nightly build of 8-16-
      04, 1.0-rc2 SNAPSHOT.


      Date: 2004-09-13 21:48
      Sender: ralfhauser
      Logged In: YES

      see also another solution in


      Date: 2004-09-07 03:50
      Sender: ianbdev
      Logged In: YES


      I posted the 872183 request.

      Since then we've come up with an alternate approach.

      See [ 1023387 ] Pagination - use subList instead of iterating
      all records.

      If this change is implemented then you can implement a List
      object that overrides the subList method of the List interface.

      This would allow you to limit database/datasource accesses
      to obtain just the few page records required for the page
      being displayed.

      No other changes to display tag are required.
      1. DISPL-122.diff
        15 kB
        fabrizio giustina


        fabrizio giustina added a comment -
        patch based on nightly build 8-16-04, 1.0-rc2 SNAPSHOT.
        fabrizio giustina added a comment - patch based on nightly build 8-16-04, 1.0-rc2 SNAPSHOT.
        added a comment -
        http://www.sneerzine.com/ <a href="http://www.sneerzine.com/">best online casinos</a> thanks
        added a comment - http://www.sneerzine.com/ <a href=" http://www.sneerzine.com/ ">best online casinos</a> thanks
        added a comment -
        http://www.mylosoft.com/ <a href="http://www.mylosoft.com/">poker</a> thanks for your site
        added a comment - http://www.mylosoft.com/ <a href=" http://www.mylosoft.com/ ">poker</a> thanks for your site
        added a comment - Texas Holdem poker online: http://www.abccasinos.com/poker/texas_holdem_poker_online.htm Best online poker: http://www.abccasinos.com/poker/best_online_poker.htm Online poker gambling: http://www.abccasinos.com/poker/online_poker_gambling.htm
        fabrizio giustina added a comment -
        fabrizio giustina added a comment - see DISPL-122 and DISPL-129


          • Reporter:
            fabrizio giustina


            • Created: