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
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