Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Processing ResultSet in JSP  RSS feed

 
Andr� Korsnes Bruns�l
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody.

I try to find out a way to process results from a database query in my jsp.

I have a servlet that performs the query, but what should I do with the ResultSet?
- Store it in the http session and fetch it from my jsp?
- Run through it and store the records in an arraylist and store the arraylist in the http session and process it in my jsp?
- Have the servlet create html to show in the jsp?
- Some other solution...?

Kind regards
Andre Bruns�l
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66184
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Run through it and store the records in an arraylist and store the arraylist in the http session and process it in my jsp?


This one is close. ResultSet and JSP are two words that should never appear in the same sentence -- in other words, you should copy the data out of the result set and close it as quickly as possible.

By why use the session? If you are forwarding to the JSP from the servlet, request scope is a better choice.
 
Andr� Korsnes Bruns�l
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bear for your quick response!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!