• 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

limit result set displayed per page

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Sorry if this question is posted elsewhere. I searched and couldn't find it. I am new to Java and am trying to develop my first database driven site using MySQL and JSP.
My problem is deciding on how to go about limiting the result set for a query. If the rs is less than 10 that is ok for my page, but if it's much more what I want to be able to do is display the initial 10 and then at the bottom of the page have numbered links like this:
2 3 4 ->
The idea is it would only ever display 3 numbers at the bottom, and then an arrow pointing either way depending upon how far into the rs you are. eg. if you were at the 45th result set that would have you on the 4th page. At the bottom the numbers would like this:
<- 3 4 5 ->
(and the number 4 would be bolded or something to indicate that is the current page.)
Hopefully I made this clear what I am trying to do. I'm not looking for the code to do this, just the logic behind it. I am very new to Java and am afraid I will approach this problem in away that is to expensive, cause my first thought was to make multiple SQL queries. I am also wondering if the rs should be loaded into an array and then possibly into the session. If I'm way off here please let me know!
Thanks,
Pat
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are looking to write the algorithm yourself, look at the paging code for jive's message board library. You can download the library and source code at http://www.jivesoftware.com.
If you are looking for a pre-written, commercial solution, then take a peek at our grid tag at http://www.dotjonline.com/taglib/grid.jsp
Hope this helps ...
 
I've been selected to go to the moon! All thanks to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic