• 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

Struts pagination review

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I've been looking at the past discussions on struts pagination, and there seem to be a lot of different approaches out there! I wondered if anyone might like to discuss the best way forward in my particular case?

It's a fairly simple application that returns an ArrayList to a jsp which then displays the info using struts-el and logic:iterate. The result set is likely to be say 40 records split into pages of 10. Thus:



So, my list composes of a series of sumAlpine beans which contain my data. I then create an image link based on these values which forwards to my next struts action, detailQuery.do.

I'd very much like to keep this current method of displaying my info, as it's one I'm comfortable with and time is tight! What would be the best way of proceeding with paginating this?

thanks for looking!

Dave
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would be interested in what solutions others have used. I was tasked with coming up with a paging solution for a Struts application about 2 years ago. At the time I ended up picking the "Pager Tag Library v2.0". Here is the url:

http://jsptags.com/tags/navigation/pager/pager-taglib-2.0.html

It is pretty easy to use and it produces acceptable results. One drawback of a tag library approach is that your complete dataset is processed by your data layer and business layer. This may not be a big deal depending on how much data your have to deal with and how much business processing your are doing (for example, my business layer often iterates through the results and translates them into a collection of objects that are more friendly for the presentation tier to work with).

My project is also implemented such that every time the user navigates to a new page, the code hits the database and retrieves a new data set. It might be a better approach to store the results on the session, but then you have to worry about saving large objects to the session. It seems like the ideal solution would direct the data layer to only retrieve the small set of data needed to display on the page, but this is the most difficult solution to implement.

- Brent
 
Dave Mere
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I went for the quickest solution I could think of! This was to bring back the whole dataset and seperate it out into subsets of 10 in the servelet, using flags set in the jsp. It works well, but in my case I'm using a local database with a small dataset so performance lag doesn't occur.

If you mwere looking at a returned set of thousands or more this approach might start to strain. Presumably in this case you'd be looking at storing the resultset in session then manipulating it for each new page?

Anyone out there worked on pagination for large datasets?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic