File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts pagination review Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts pagination review" Watch "Struts pagination review" New topic
Author

Struts pagination review

Dave Mere
Ranch Hand

Joined: Oct 25, 2004
Posts: 37
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
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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

Joined: Oct 25, 2004
Posts: 37
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts pagination review