nitin_bahri
asked on
Jsp pagination
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......
ca u plz elaborate the question?
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. :-)
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. :-)
ASKER
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
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
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("coun t");
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
here 'result' is a vector holding all the records from my resultSet. You can modify that to suit ur code...
count = request.getParameter("coun
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
ASKER
this stilldoes not solve my purpose
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Could I help you ?
ASKER
Thanx friend.... sorry for the delay