Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes Using the Resultset obj from Dao layer to Jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Using the Resultset obj from Dao layer to Jsp page" Watch "Using the Resultset obj from Dao layer to Jsp page" New topic
Author

Using the Resultset obj from Dao layer to Jsp page

shiva valanukonda
Greenhorn

Joined: Sep 27, 2010
Posts: 25

Hi ,

I want to display the ResultSet object data which is fetched from the database on to the JSP page.
Initially i tried using the ResultSet directly into Jsp page by returning ResultSet obj from Dao Layer.
Like:
TestDaoImpl.java --> which will return the Obj as ResultSet.
TestServiceImpl.java --> which will call the ResultSet obj from DaoImpl.
ViewPage.jsp --> which will read the ResultSet Obj and iterate through the data and display the data.

But here, i want to know, how do we reduce the Database logic in Jsp page .

Thanks
Shiva
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

Never pass a result set anywhere. You should copy the data from the result set into normal Java collections and/or beans and close the result set as soon as possible.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using the Resultset obj from Dao layer to Jsp page