• 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

Pagination in jsp

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

I am displaying currently a 100 records in my table which are fetched from the databse.But i need to display only first 10 records in the table and there will be a next button.after clicking on that next 10 records have to be displayed.
Similarly there will be a previous button ,on clicking that previous 10 records have to be displayed.

Can u help me on that.

With regards,
Neela
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi This is what i use for paging using JSTL,you may modify this to suit ur need


 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes paging is easy when using a database, simply manipulate the LIMIT clause for each page, i.e.

items_per_page = 10;
total_pages = (SELECT count(*) FROM table) / items_per_page;

this_page_content = SELECT a_column FROM table LIMIT 1 to 10;
[ March 11, 2005: Message edited by: Daniel Rhoades ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

simply manipulate the LIMIT clause



Assuming that the DB supports such a clause. Not all do. PostreSQL, for example, has the LIMIT and OFFSET clauses that make dataset paging almost trivial.
[ March 11, 2005: Message edited by: Bear Bibeault ]
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, there are some sorry excuses for DB engines out there
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic