Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

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: 67497
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
 
He was expelled for perverse baking experiments. This tiny ad is a model student:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic