Hi people: I'm a beginner developer JSP/Java and i need a help to create some application for display the result of my search in DB in multiple pages ... Like a forum, with previus and next stuff ... Someone can help me ?! Thanks !
I'm not aware of a safe, generalized way to do this. I've done several apps where we retrieved data from a backend service and limited the number of rows that would fit in one response. If the user wants to see more data, the client has to ask for the "next" set of rows. If the data is not changing all the time, this isn't too hard. We have used a row number so the client request is give me rows 51-75, 76-100, etc. The server repeats the query used the first time, skips n rows, and gives back the next batch. We have also used the last primary key retrieved - give me 25 rows starting with the first key > this one. Either of these runs into trouble if the result set is changing - more rows or fewer rows or different rows than it had last time. Page forward might skip some rows. Page forward and backward might not give you the same results you saw before. I suppose the surest way to give the user a self-consistent view is to retrieve the whole superset and store it somewhere, then page forward and backward through the private copy. That blows away the notion of a stateless server, tho.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi