• Post Reply Bookmark Topic Watch Topic
  • New Topic

Display content of a ResultSet with JSTL  RSS feed

 
Alejandro Montenegro
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Im looking for some kind of "best practice" to show the content of a ResultSet with JSTL. I'm trying to implement some kind of MVC by hand so I don'y want to use JSTL's sql tags. I use a servlet to make the query at the database and then put the ResultSet in session scope by using:


Any idea how to display the content, for example with JSTL's foreach tag
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by A Montenegro:
Hi, Im looking for some kind of "best practice" to show the content of a ResultSet with JSTL.
Best practice is not to do that! After all, how are you going to guarantee proper close()ing of the result set? Best practice is to shovel the results into a domain model, a List of objects, a List of Maps, a CachedRowSet, or whatever. That also solves the problem of how to iterate over them, since forEach will be happy with any of these.

I'm trying to implement some kind of MVC by hand [...]
That certainly isn't best practice

- Peter
 
Alejandro Montenegro
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter den Haan:
Best practice is to shovel the results into a domain model, a List of objects, a List of Maps, a CachedRowSet, or whatever.


Thanks I will do that
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!