hi Paul, i store the whole 2-d array in the hashtable whose values maybe null sometimes, but the whole array will never be null , and thats all i store as an object in the hashtable. when i said nullpointer exceptions, i meant the retrieval of data from the array whose one or more elements may be null.
regards, amit -----Original Message----- From: Paul Copeland [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 9:07 AM To: [EMAIL PROTECTED] Subject: Re: Use of Vectors in JSP Amit - java.util.HashMap allows null values whereas java.util.Hashtable does not allow null values. Deepak - JOT Servlets provides an Iterator bean that wraps a JDBC ResultSet for repeating rows of output on a web page. You can work directly with the ResultSet methods instead of transferring the values to another Collection like a Vector. -- Paul Copeland, JOT Object Technologies - http://www.jotobjects.com > ------------------------------ > > Date: Tue, 19 Nov 2002 03:50:31 -0600 > From: Amit Wadhwa <[EMAIL PROTECTED]> > Subject: Re: Use of Vectors in JSP > > i use a 2-dimensional array. > i have a bean to which i send the query, > the query is processed by the bean, stored in an 2-d array, and the > array is stored as an object in a hashtable which is returned to the > calling jsp/servlet where i iterate thru the 2-d array and get the > results. > its working pretty ok but u have tro b careful about null pointer > exceptions. > anyone with any suggestions on this? > > ***************************************** > Amit Wadhwa > Technical Support Representative, > Dell International Services, > Bangalore > ***************************************** > > -----Original Message----- > From: Hans Bergsten [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 19, 2002 10:47 AM > To: [EMAIL PROTECTED] > Subject: Re: Use of Vectors in JSP > > > Deepak wrote: > >>Hi all >> >>Would you recommend the use of Vectors in jsp pages to hold the query > > results > >>from a database? >> >>Is it ok then performance wise to iterate over the vector and display > > the > >>items in the jsp page? >> >>For example, a method in a javabean executes a jdbc statement that > > returns > >>some recordsets. These recordsets are added to a Vector and the Vector > > is > >>returned by the method. >> >>In my jsp page I get the Vector with recordsets from the bean method. >>Then I iterate over the Vector to display its items in a html table. >> >>Is this a good way of doing things? >>If not can anyone suggest a better way? > > > The methods in Vector are synchronized, so a List or an array is a > slightly more efficient approach. But I would suggest that you look at > JSTL instead. It's <sql:query> action exposes the query result as a > type called a Result. From a Result, you can get an array of arrays > where the first dimension represents rows and the second the column > value, or as an array of Maps where each Map represents a row, with > keys matching column names. Even if you access the database in servlet > code (for instance), you can use utility methods to convert a JDBC > ResultSet to a JSTL Result. > > For more info, see: > > <http://java.sun.com/products/jsp/jstl/> > > Hans ======================================================================== === 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 =========================================================================== 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