Forums Register Login

limit result set displayed per page

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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 ...
Do you want ants? Because that's how you get ants. And a tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 678 times.
Similar Threads
Beginner Yahtzee Progam
digital combination lock problem
Possible memory problems from using sessions?
Problem with Result Set pointer.
What am I missing here? (ArrayList check)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:24:52.