This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A Pagination Technique Using Spring 3

 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to incorporate pagination in my spring 3 MVC application. Is there any standard pagination component spring provides?

Any good example I can refer to?

Thanks,
Sachin
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well depends what you mean by 'pagination'

You can have a look at PagedListHolder there is a little example on the link below:

http://stackoverflow.com/questions/2245035/how-to-implement-pagination-in-spring-mvc-3

If you are just trying to paginate data from the database that your are retrieving in your services you can do it write it yourself or if you are using spring-data-jpa they have some nice pagination stuff as well.

Depending on how you are displaying your data you might want to look at some of the nice jquery data table options there are a couple out there I have used. I really cant give you more without more detail as to what you are trying to do.


Bill
 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,

I am using jsp, Spring 3, Hibernate and MySQL. I am retreiving article list from service and displaying on jsp page. Implementation is something like below,

Controller code


on my JSP, I am displaying

ArticleTitle
ArticleRent
ArticleDescription
ArticleUserFirstName
ArticleUserLastName
ArticleImage

etc....

How to set list in PageListHolder and how to use it in jsp? I want JSP to have buttons like Next, previous, 1, 2, 3 like we see on most of the applications for going to next page, previous page or specific page.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you click the link Bill gave you? That gives you all the information you need. It even has sample code. All done for you.

Sorry, but we can't do all your work.

Mark
 
sachin pachpute
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks Bill. I could work on this piece only yesterday and it didn’t even take an hour. Never thought it would be that straightforward

Another good example I found was,

http://www.developer.com/java/web/article.php/10935_3830886_2/A-Pagination-Technique-Using-Spring.htm
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your very welcome Sachin I am glad you got it all worked out
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic