• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ResultSet Paging Help

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a datasource with a list of information and need to implement a paging function, where for example, instead of showing all 1000 results, I want to display 25 or 50 per page..
I am considering using the Page-By-Page Iterator, but is there a way to do the same thing without using this pattern?
Thanks
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hhmm... I'm not too familiar with the Page-By-Page Iterator design pattern... but one idea that comes to my mind is to put the results in a vector and now you have control over the number of elements you want to display in every page. You can also control the >>next and <<back link.
it's only a suggestion... it's probably the same as page-by-page
cheers
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question has been covered nicely in the Servlet, JSP and JDBC forums. I would recoomend a search in those forums first.
The short answer is that there are several possible solutions and the specific one you go with depends on your what you are doing.
Dave
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pass a parameter called page numer to the jsp page which is going to display result set.Restrict the no.of records per page like 25.now go to the record 25 * pagenumber and start to display upto 25 records. Put two buttons as previouse<< and next>> . In on click event handler of the previous button reduce the page number and call the same page. In on click event handler of the next button increase the page number and call the same page.
 
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by lakshmi rajagopal:
pass a parameter called page numer to the jsp page which is going to display result set.Restrict the no.of records per page like 25.now go to the record 25 * pagenumber and start to display upto 25 records. Put two buttons as previouse<< and next>> . In on click event handler of the previous button reduce the page number and call the same page. In on click event handler of the next button increase the page number and call the same page.



Where will you have th ResultSet onject. ?
In Session??
Since you are passing the request to same JSP page. naturally you will not Query the database everytime.
Do you have any idea of using RowSet or CachedRowSet instead of this.
Thanks.
 
david andre king
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx for all the suggestions, I have a copy
of a good JSP book by Duane Field that refers to
a CachedRowSet Impl.
I want to retrieve a list of articles and populate an ArrayList or Vector.. (i made it that far), I just need to figure out the displaying of records.
For ex. if I have 100 records, I want to display
1-25, 26-50 ,etc..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic