?
Solved

Jsp pagination

Posted on 2001-07-20
8
Medium Priority
?
741 Views
Last Modified: 2007-12-19
I want to paginate results extracted from a resultset object. I want the next and previous buttons to be displayed at the bottom as per the records. Could anybody provide me the code for this? Thanx in advance......
0
Comment
Question by:nitin_bahri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:mail2yogi1
ID: 6302609
ca u plz elaborate the question?
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6302693
Just a comment: If you want to paginate to HTML, don't. HTML is very bad for printing output. There's no way to define page header and footer in HTML.

If you need well formatted and printable presentation on the web, I suggest to use PDF. This is a lot of work, but you will get very beautiful on-the-fly PDF documents.

Hope, I didn't misunderstand you. :-)
0
 

Author Comment

by:nitin_bahri
ID: 6304304
Friends,I think you have misunderstood me. My problem goes something like this:

I have a recordset which contains say n records. Now I want to display these records in my jsp page using 50 records per page. If the no. of records exceed 50 then the remaining records should be displayed on the next page with the previous and next buttons and so on...I think this should be enough.... Please help asap...its urgent...thanx
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:viji2000
ID: 6304382
I had worked on a similar requirement for one of my codes.. this is what id done.. dunno tho if it would help u..


here 'result' is a vector holding all the records from my resultSet. You can modify that to suit ur code...


count = request.getParameter("count");
int counter=0;
for (int i=count; i<result.size(); i++) {

   //.... ur code here
   counter++;
   count=i+1;
   if(counter==10)  break;      // The list displayed should contain only 10 numbers at a time
}

if(result.size() > 10) {
  if( result.size() != count) {
 /// Display the next button to get the next batch
  }
}

and store the count value as a hidden variable in the generated jsp document. So when the user clicks the next button he would be redirected to the same page and will be displayed only the next set of records..

Note: The first time this page is called the count variable should be 0. so u could assign it when u get a NullPointerException or make sure its in the Query String with a value of 0.

hope this helps
0
 

Author Comment

by:nitin_bahri
ID: 6316707
this stilldoes not solve my purpose
0
 
LVL 3

Accepted Solution

by:
graf27 earned 150 total points
ID: 6337092
0
 
LVL 3

Expert Comment

by:graf27
ID: 6430878
Could I help you ?
0
 

Author Comment

by:nitin_bahri
ID: 6431015
Thanx friend.... sorry for the delay
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question