Hi I have a question regarding what is the best way to get information from a vector (following are the examples: both work fine but which one should be used)
>From my JSP page I call my Java bean which connects to database, get the results and >returns a vector to JSP. In the JSP page I have two choices I can use ENUMERATION >and get the information from database Or I can get the size of the vector and use a >for loop to read the info in the vector. Both of these work fine. I want to know which is better performance-wise so I should stick to using that one only. Any suggestions will be greatly appreciated. If should do be doing some totally new concept, please let me know. Thanks ******** Enumeration Example ************************* Vector vrs = new Vector(); vrs = sqlAbcBean.getKeyPersonnel(district); Enumeration rs = vrs.elements(); while(rs.hasMoreElements()){ a = rs.nextElement().toString(); b = rs.nextElement().toString(); c = rs.nextElement().toString(); d = rs.nextElement().toString(); e = rs.nextElement().toString(); e = rs.nextElement().toString(); } ******** For Loop Example ************************* Vector vrs = new Vector(); vrs = sqlAbcBean.getKeyPersonnel(district); for(int i = 0; i < vrs.size(); i=i+6) { a = vrs.get(i).toString(); b = vrs.get(i+1).toString(); c = vrs.get(i+2).toString(); d = vrs.get(i+3).toString(); e = vrs.get(i+4).toString(); f = vrs.get(i+5).toString(); } =========================================================================== 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