Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

retrieving data pagewise

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to retrieve data from mysql database using jsp and servlets and display it in pages, 5 records per page. And provide for link to next page to display next 5 records. I am using command like SELECT name,date,message FROM my_table ORDER BY date LIMIT 5 OFFSET 5 to display 5 records. Please anyone suggest me how to display the records in pages. I am using netbeans 6.5


Thanks in advance.
 
Sheriff
Posts: 67402
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you already know about LIMIT and OFFSET you are obtaining the data in pages already. What's your specific issue?
 
Shashank Anand
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to know how to provide links to different pages with result got as above (using resultset and stored in arrays), if I am using the above code is a jsp page.



Thanks.
 
Bear Bibeault
Sheriff
Posts: 67402
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Links have nothing to do with resultsets. You'd simply need to keep track of what "page" you are one (perhaps in a hidden input) and increment it for "next" or decrement it for "previous".
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic