This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If at all you are looking for making the resultset available to the called JSP, I would put the resultset into a session and call the jsp. You can also put the resultset into a request, call the jsp and can achieve the same results. By putting in session, I make sure that those values are available across all requests with in the session.
Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
Hey don't store a ResultSet into a session. A ResultSet is connected to the database on which the query was run. If you store a ResultSet then strange things might happen. The connection to the database might remain open. But I think it will not allow you to add a ResultSet object to a session (I once tried to return a ResultSet from a RMI server and it didn't work).
Instead use javax.sql.rowset.CachedRowSet i.e. store it in the session as it follows disconnected architecture. For details refer to the JDK Documentation.
Can you explain how you were not able to add a Resultset to session and what was the problem you encountered.
Well I didn't store the ResultSet in a session. I actually returned a ResultSet from a RMI method. But it gave me some error at run time(I don't remember what). I think it's because ResultSet is not Serializable. Now I think that if that's true then CachedRowSet will not work either as it is also not Serializable. Bear Bibeault is right, you should use some Collection or Map implementation...