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?
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:
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.
Joined: Oct 25, 2004
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?