Utilising Paging of results
I want to give my users the ability to page through the results rather than delivering all results to one web page. I was thinking what is the best way to do this. So far I have thought of
1. Use a scrollable resultset and store rs in session.
2. Hit the database to get the IDs and store these in the session and then hit the dbase each time the next or prev button is pressed (Thought this way might be slow)
Any ideas welcomed.
I would suggest against putting a restultset in a session. A resultset keeps a connection open to the database and a session usually lasts 30 minutes. That is prohibitively long to keep one connection open to the database. You would see performance problems as soon as you deployd your app.
I would either read the whole resultset into some type of collection (that you can then put in the session) and read through it at your leisure later, or if you have a database that can handle it (like MySql) you can provide starting indexes and number of records to retrieve in the query. See the LIMIT keyword in the SELECT syntax