As ResultSet isn't serializable object,I cannot pass it into Client. I ever hear about javax.sql.RowSet.How shall I use it? Please tell me about implementing and using javax.sql.RowSet or if you have the other method for passing this ResultSet,tell me too. Besides,I don't know about structure of queried information. Consequently I cannot use Array or Collection. Thanks,Ben
Mahesh Kulkarni
Ranch Hand
Joined: Jul 05, 2001
Posts: 62
posted
0
Hi benjamas , Resultset can be sent to a jsp through session.I hope you are retrieving the data from the data base in a servlet.Put that retrieved resultset in session as follows. String sql="select * from tablename"; Statement stmt=null; Connection con=null; stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); HttpSession session=request.getSession(true); session.setAttribute("rs",rs); Now in your jsp get the value of this by following code <%session = request.getSession (true) ;<br /> rs=(ResultSet)session.getAttribute("rs");<br /> %> Display this in tabular format as follows <%while (rs.next())<br /> {<br /> %> <tr><td><tr> table goes here <%<br /> }<br /> %> I hope this will solve your problem. Thanx, Mahesh