This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi guys, I was just wondering what the object type my serlvet should send to the JSP After I do a DB query? The DB query yields a ResultSet, should I pass this to the JSP which will then loop through and place the relevant information or should it be a HashMap or something else??
If you want clients to have direct access to a database, install a database client on their machine. It'll eliminat the need for JSPs altogether!
Okay, I'm being snide. I apologize.
You really want to minimize the amount of data sent to a JSP from a Servlet. Only send what needs to be displayed. And you really don't want to send DataBase objects - they tend not to be too serializable.
Figure out what you need to send to the JSP purely for display purposes, see if there isn't so handsome and sexy collection class you can stuff that into, and then have the JSP do a standard looping over the collection class.
Oh, and make aure you're using the HttpServletRequest for passing that data. It'd be a real waste to use the session ,and have all that data needlessly follow a client around the website. [ August 27, 2006: Message edited by: Bear Bibeault ]