File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Pagewise Results Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Pagewise Results" Watch "Pagewise Results" New topic
Author

Pagewise Results

ch praveen
Ranch Hand

Joined: Mar 08, 2004
Posts: 67
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.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

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



http://home.arcor.de/hirnstrom/bewerbung
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

That approach will obviously not work in the web environment. But the original poster wasn't very clear on that.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ch praveen
Ranch Hand

Joined: Mar 08, 2004
Posts: 67
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.
Pawan Ramchandani
Ranch Hand

Joined: Aug 15, 2003
Posts: 78
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


Pawan Ramchandani<br />*******************************<br />SCJP 1.4<br />SCWCD <br />*******************************<br />Everything is okay in the end. If it's not okay, then it's not the end.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

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

Joined: Mar 08, 2004
Posts: 67
Hello Bear Bibeault,
I want to display results in a webpage.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagewise Results