File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pagination in jsp

 
Neela Sathesh
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Praful Thakare
Ranch Hand
Posts: 642
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi This is what i use for paging using JSTL,you may modify this to suit ur need


 
Daniel Rhoades
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, there are some sorry excuses for DB engines out there
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic