Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Returning the ResultSet to the JSP

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

 
Paul Clapham
Sheriff
Pie
Posts: 20958
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure you can. But there are numerous good reasons not to do that, so you shouldn't.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you paul , but can you please tell me why we should not do that way ??
 
Paul Clapham
Sheriff
Pie
Posts: 20958
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya , Thank you .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic