Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: paging

  1. #1
    Join Date
    Dec 2004
    Posts
    1

    Default paging

    I am working on a website that contains a table that is too big to be displayed on a single page; hence, the user must be able to select the page number to which he/she would like to navigate from a list of pages.

    Is there a method to handle this type of functionality in spring?

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, ON, Canada
    Posts
    101

    Default

    See the jpetstore example in the Spring distribution. The ViewCategoryController uses a PagedListHolder.

    Another solution would be to use the DisplayTag library. Google for it, pretty cool stuff.

    S.

  3. #3
    Join Date
    Dec 2004
    Posts
    29

    Default

    What about performance?

    I assume, PagedListHolder works only when you load the entire result set into it and then displays only the current page, right?
    But that means we have to load the entire result set of maybe 1,000 rows first.

    However we need only 10 rows to display and it's not performance-wise to load more than 10 for our needs. Can you please clarify a little bit, if I'm wrong here?

  4. #4

    Default

    DisplayTag is entirely view so yes you are right you would load everything into memory.

    Options to consider are: demand loading any component parts (still need to load all the parents but it would make what you are loading smaller) and hand-coding a solution in the controller. Tricky bit of course comes if you or another process modifys whichever collection you're working with: you really dont want to keep a transaction open whilst the user pages a list...

  5. #5
    Join Date
    Dec 2004
    Posts
    29

    Default

    Okay, so as long as we need to operate large result sets from database, it would be much more preferrable to use database means for results paging.
    Like "LIMIT 0, 10" in MySQL or setFirstResult() and setMaxResults() in Hibernate Queries.

  6. #6

    Default

    Have you seen this?

    http://valuelist.sourceforge.net/
    J2EEGuru,
    The Spring Advocate

  7. #7
    Join Date
    Dec 2004
    Posts
    29

    Default

    The setup process seems to be a little bit overcomplicated.
    Some people might like it, but I guess just for my application I'll use custom solution like Hibernate features.

  8. #8

    Default :(

    I think valuelist is better than displaytag now. It seems that I need have to write an adapter to paging using Hibernate.

    Is there anyone who have written this paging adapter?

  9. #9

    Default

    Perhaps this isn't the best idea, but I just expose an int firstResult, int maxResults to queries in my hibernate dao that need paging, and
    add a query to return the count for the corresponding query.

    I manage page counts, etc in a service object, and use jstl tags to render
    the html table view. Simple and works.

  10. #10
    Join Date
    Nov 2004
    Location
    Jogjakarta, Indonesia
    Posts
    40

    Default

    Quote Originally Posted by standev
    Okay, so as long as we need to operate large result sets from database, it would be much more preferrable to use database means for results paging.
    Like "LIMIT 0, 10" in MySQL or setFirstResult() and setMaxResults() in Hibernate Queries.
    I don't think this is a good idea since it is a dbms dependant.

Similar Threads

  1. Replies: 7
    Last Post: Nov 16th, 2006, 05:28 PM
  2. Pageable data list with Hibernate
    By robmorgan in forum Data
    Replies: 23
    Last Post: Jul 24th, 2006, 06:12 PM
  3. pagination and continuation problem in SWF
    By yfmoan in forum Web Flow
    Replies: 6
    Last Post: Jun 29th, 2005, 03:42 AM
  4. Paging with jdbc.object (the right way ?)
    By lionellaurent2 in forum Data
    Replies: 2
    Last Post: Apr 25th, 2005, 01:57 AM
  5. Paging with iBATIS
    By ndijkstra in forum Data
    Replies: 1
    Last Post: Sep 8th, 2004, 04:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •