Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Pagewise Results

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,
I have got a lot of records to display. Instead of displaying them all at once I want to display 20 records per page. Please suggest me way to accomplish this and if possible provide snippet regarding this. Thanks in advance.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ch praveen:
I want to display 20 records per page.


 
Sheriff
Posts: 67620
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
That approach will obviously not work in the web environment. But the original poster wasn't very clear on that.
 
ch praveen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,
Thanks for ur responses. But It didn't answered my question. Is there any command in Java that accomplishes displaying only a certain portion of ResultSet [0-20,20-40 records and so on]? Whether I must write my own coding to skip the unnecessary records and to reach the necessary records range? JavaRanch displayed pagenumbers such as 1>>2>>3>>..... and showed only certain messages(posts)in a webpage. I want similar approach in displaying ResultSet contents in my application. Can JavaRanch people help me in accomplishing this.
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using below mention code to solve that kind of problem in my project and it's working properly
TRY TO UNDERSTAND THIS CODE
__________________________________
First declare one integer:-
int start=0;
__________________________________
when you print the user values just increment the value of this int:-
out.println("<tr><td>"+(start+(noOfComp++))+"</td><td>"+job+"</td></tr>
__________________________________
put this code with result set:-
for(int i=0;i<start;i++) rs.next();
int noOfComp=1;
if(rs.next())
___________________________________
and put this code where you want to give link on next page:-
if(noOfComp>10) break;
}while (rs.next());
if((start+noOfComp-1)<count)
out.println("<TR><td colspan=6><a href=page5.jsp?start="+(start+noOfComp-1)+">Next Page</a></td></tr>");
}
____________________________________
ALL THE BEST
 
Bear Bibeault
Sheriff
Posts: 67620
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

Can JavaRanch people help me in accomplishing this.


How are we supposed to do this when you haven't said where you want to display this? A Swing app? Web? Console? PDF document?
Incomplete questions will get you incomplete answers or no answers.
 
ch praveen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bear Bibeault,
I want to display results in a webpage.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic