Manish,
You don't need to alocate the space first. Assuming that when you attempt
to do this, you know that your vector contains only strings, you should
probably do
one of the following:
String[] values = (String []) ((Vector)
session.getAttribute("qty")).toArray(new String[0]);
In the above case, the toArray method will create an array of the
appropriate length of type String[].
If this is to be used in a loop or something of the sort with:
Vectors of a known maximum size (100 in this case)
Vectors with no nulls stored as elements
then the following should be used instead:
String[] values = new String[100];
<start loop> {
// this places the contents of the vector into the array
values.
((Vector) session.getAttribute("qty")).toArray(values);
<other processing>
} <end loop>
-AMT
> -----Original Message-----
> From: Manish Joshi [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 17, 2001 12:57 AM
> To: [EMAIL PROTECTED]
> Subject: VECTOR TO STRING ARRAY?
>
>
> hi all
> i m tryin this
> String values[]=new String[100];
>
> values=((Vector)session.getAttribute("qty")).toArray();
>
> how do u assign vector elements to a string array?
> any help?
> thx
> MJ
>
> ==============================================================
> =============
> 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://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
=====================================================================
Warning: All e-mail messages sent to or from this address are recorded by
the iPIN corporate e-mail system and may be subject to archival and review.
Furthermore, information in this e-mail may contain privileged or
confidential information and is intended only for the recipient. If you
receive this message in error, notify iPIN immediately by replying to this
message and then deleting it from your computer. Any information in this
e-mail doesn't necessarily reflect the views or opinions of iPIN.
====================================================================.
===========================================================================
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://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets