Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pagination Framework/libraries

 
Pallav Bora
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My application is struts 1.38 application.

We have a pagination requirements. What would be a best pagination library? We would like to avoid storing huge collection in memory.

Thanks
 
Tim Moores
Bartender
Posts: 2802
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DisplayTag comes to mind.
 
Claudiu Chelemen
Ranch Hand
Posts: 75
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've also used the pager plugin on the jquery-based tablesorter, it's quick and simple.

http://tablesorter.com/docs/
http://tablesorter.com/docs/example-pager.html

Cheers,
Claudiu
 
sreejith sreedharan
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
best option is to create a custom pagination , with offset limit star , end in the sql query .

common method .

1 . getTotalRecord count
2 . get the page number
3 . get the start , rowlimit
4 . create sql query based on this . with offset cluase
5. show data
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just to share my opinion, given the problem statement, i would ask myself several questions like

What are the records that I am paginating? Are they simple records(1 or 2 columns from DB) or some table of data with several number of columns?
Is the data listing being paginated is static or dynamic?
If it is a table with several columns then how is the database designed? Is it normalized? If it is properly normalized, at an average how many tables i join to fetch the listing?
Is my application rich in GUI?
How many listings do i have to paginate?

The reasons for these questions being that, when any application is under development or initial phases of production it would be happy day scenario. As the software evolves and the user base increases the data increases. Say, if the DB is very well normalised and to fetch a listing i have to hit some 5-10 tables and day-day the data kept on increasing. Very quickly we have look in terms of performance.
Good libraries like "DisplayTag/TableSorter" is very easy to plugin and effective but (it paginates at UI level) when the day comes that you do not want to fetch all the records from DB instead you would only want just 30 records which you display in UI? Then we end up opening the opensource. We tend to do all the pagination and sorting stuff at query level.
If the number of listings that are being paginated are few, then i would go for a library like DisplayTag.
If application UI is rich (normally might not be in this case as struts 1.3 is chosen) i would go for somthing like TableSorter due to the look and feel (again i would consider the performance)

Finally if the problem statement/requirement is as minor as pagination, I would implement it based on the application needs. I would still prefer see how these DisplayTag and TableSort are implemented and make sure i get the best out of it and also make sure that i do not missout or make silly mistakes while implementing the custom solution since sometimes it gets tricky while implementing the "Page Jump" & and other types of navigations along with sorting.
However, it would be a matter of coding some 5-10 simple java files after initial analysis and design. Which sould not take much time.

Bottomline - I agree with Sreejith
 
Sunil Sunny
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use Dispaly tag libraray http://displaytag.sourceforge.net/11/tut_externalSortAndPage.html
 
Pallav Bora
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everybody for your responses !
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pallav, 'pagination' not a big solution, share your final decision with reasons if possible (just curiosity) to close the post (might be useful for someone else). Let it be how silly or genuine it might be, it's ok.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic