File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes Returning the ResultSet to the JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Returning the ResultSet to the JSP" Watch "Returning the ResultSet to the JSP" New topic
Author

Returning the ResultSet to the JSP

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

Can this be possible .

When i get the data from the database , it is filled up on to the ResultSet ,and from there on into Collection classes.

Can i put this ResultSet in a scoped attribute and send it to the jsp (Instead of putting the Data on to the Collection class)


Save India From Corruption - Anna Hazare.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19319
    
  10

Sure you can. But there are numerous good reasons not to do that, so you shouldn't.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you paul , but can you please tell me why we should not do that way ??
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19319
    
  10

Mostly because you can't access the methods of the ResultSet in JSTL. You'd have to write scriplets to access it instead. Not to mention that you won't have access to the connection, so it won't be closed properly after you finish using the ResultSet. It's just a bad programming practice to pass ResultSet references around in this way, even within a single program.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Ya , Thank you .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Returning the ResultSet to the JSP