Re: Use of Vectors in JSP

2002-11-24 Thread Paul Copeland
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



JSP for VoiceXML

2002-11-24 Thread Sanjika Abeyratna
How to set content type for VoiceXML files
 .vxml

Anyone know this?


Thanks
 

==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



Re: Use of Vectors in JSP

2002-11-24 Thread Amit Wadhwa
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



[no subject]

2002-11-24 Thread Dinesh
Hi,
   i want to know the differences b/w legacy classes and java2 collection API..what 
are the advantages of collection API over legacy classes..why sun has brought 
collections API..

give me details on this..

thanx in advance

==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



[no subject]

2002-11-24 Thread Vikramjit Singh
http://www.javaworld.com/javaworld/jw-11-2002/jw-1101-collections.html

 -Original Message-
 From: Dinesh [mailto:[EMAIL PROTECTED]]
 Sent: Monday, March 25, 2002 2:14 PM
 To: [EMAIL PROTECTED]
 Subject:


 Hi,
i want to know the differences b/w legacy classes and
 java2 collection API..what are the advantages of collection
 API over legacy classes..why sun has brought collections API..

 give me details on this..

 thanx in advance

 ==
 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

Disclaimer: This e-mail message along with any attachments is intended only
for the addressee and may contain confidential and privileged information of
GTL Limited. If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this
communication is strictly prohibited. If you have received this message by
error, please notify us immediately, return the original mail to the sender
and delete the message from your system.

===
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



Re: Hashtable / HashMap Problem.

2002-11-24 Thread Adrian Janssen
use a TreeMap if you want the entries to come out sorted.

 -Original Message-
 From: Lakshmeenarayana G G [SMTP:[EMAIL PROTECTED]]
 Sent: 23 November 2002 07:27
 To:   [EMAIL PROTECTED]
 Subject:  Re: Hashtable / HashMap Problem.

 Well guys...
 I got so confused with all these Collection API..
 At last I sorted the values by using...

 ArrayList alist = new ArrayList(hashmap.values());
 Collections.sort(alist);

 Then with the original map, I am looping through and getting the keys for
 the sorted values and in the loop I am feeding it to two Object Arrays.
 One
 for the Key and one for the Value.
 Now the two Object Arrays are having the sorted key values.

 I know this is not efficient way of implementing this solution.
 But why SUN has not given the hashmap.sortOnKeys() ??
 Ok if hashMap takes the null values.. then at least they could have given
 hashtable.sortOnKeys()...??!!!

 thanks again for your time.

 Cheers..
 L G Goundalkar.

 -Original Message-
 From: A mailing list about Java Server Pages specification and reference
 [mailto:[EMAIL PROTECTED]]On Behalf Of Amit Ghaste
 Sent: Saturday, November 23, 2002 1:46 AM
 To: [EMAIL PROTECTED]
 Subject: FW: Hashtable / HashMap Problem.


 I wonder why my reply went to the user and not to the list...

 anyways sorry to send it to uy directly

 but u can use java.util.LinkedHashMap as shown below

 Regards
 Amit

 -Original Message-
 From: Amit Ghaste [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 22, 2002 12:32 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Hashtable / HashMap Problem.


 internally the hashtable stores object refrences according to hashcodes,

 if u get an enumeration of the stored values or keys, the order is not
 predictible

 its the same result with a iterator

 since hashmap is similar to hashtable (except that its meathods are not
 synched) it will give u the same result

 to preserve order use the LinkedHashMap... this preserves the order when u
 retrive it thro the keyset iterator
 but its meathods are not synchronized... so if u are doing multi threaded
 operation on shared data u need to synch it

 get more info from the api

 if that helps
 Amit


 -Original Message-
 From: A mailing list about Java Server Pages specification and reference
 [mailto:[EMAIL PROTECTED]]On Behalf Of Lakshmeenarayana G G
 Sent: Thursday, November 21, 2002 8:51 PM
 To: [EMAIL PROTECTED]
 Subject: Hashtable / HashMap Problem.


 Hi,

 I am using Hashtable or HashMap to keep Key-Value pair of elements.
 But When I add them, The Hashtable or HashMap gets sorted depending on the
 keys.
 I want to retain the order in which I have added the key-value pair.
 Is there anyway to do it with Hashtable or HashMap ?

 Or Can I use any other Collection type which will have the mapping of
 key-value which is not sorted other than two dimensional Array.

 Thanks for the time.
 Lakshmeenarayana G G
 CLI Division - SysArris Software
 Bangalore - India
 Tel. No. +91-80-665 4965, 665 5052, 664 2690 Xtn-240
 Fax No. +91-80-665 0374, 655 4285
 http://www.sysarris.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

 ==
 =
 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
--

It is the strict policy of Truworths that its e-mail facility and all
e-mail communications emanating therefrom, should be utilised for
business purposes only and should conform to high professional and
business standards.   Truworths has stipulated certain regulations in
terms whereof strict guidelines relating to the use and content of
e-mail communications are laid down. The use of the Truworths e-mail
facility is not