Joshy,

It's a very good instinct that you have, to want to push the ResultSet
further away from your JSP pages.  Probably the main reason for doing so is
that in the future you can change the way your objects (i.e. Employees) are
stored in the database without having to rewrite tons of code.

In general, for small operations like querying and retrieving a reasonable
number of Employees (say, less than a few hundred) the performance
differences between implementations of lists/collections is negligible.  But
to give yourself the most flexibility, you should have your Java method's
signature return the most general interface it can (probably java.util.List,
or maybe java.util.Iterator).  That way, your JSP's won't care about what
type of list you're actually using, and you can change it if your needs
change.

For example:

public static List getEmployees()
{
    // retrieve employee info from database
    ...

    // create a list object for storage
    List list = new ArrayList();

    // populate list
    ...

    return list;
}

In answer to your question about what actual collection object to use, that
depends on what you are going to do with it.  For example, whether you are
going access the data randomly or in order, whether you need synchronization
(probably not in your case), whether you are going to be adding/deleting
elements, etc.

Hope this helps...

-jmc

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to