Yes. Look at the J2SE API for java.util.List. You will find 2 toArray() methods documented there.
Mark -----Original Message----- From: Sathya [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 04, 2002 2:04 AM Is there anyway that I can convert list to array back. The problem is I need to use this in java not in servlet so I cannot store it in context. I thot of using it as a static array. But for array I cannot allocate the memory in the beginning as I would knowing the number of files only in runtime. ----- Original Message ----- From: "Galbreath, Mark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 01, 2002 6:15 AM Subject: Re: Global variable > I don't understand what you are saying here. If you have a bunch of > filenames, put them in a List: > > List filenames = new ArrayList(); > filenames.put( filename1); > filenames.put( filename2); > ... > > Store them as a "global variable:" > > ServletContext context = ServletConfig.getServletContext(); > context.setAttribute( "filenames", filenames); > > Retrieve from global store: > > List filenames = (List) context.getAttribute( "filenames"); > > Retrieve all filenames: > > Iterator i = filenames.iterator(); > while( i.hasNext()) { > out.println(( String) i.next()); > } > > Delete a filename: > > filenames.remove( "fielname1"); > > > What could be easier? > > Mark > > -----Original Message----- > From: Sathya [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 01, 2002 11:55 PM > > But, I cna only set string in attribute nit string array. > > ----- Original Message ----- > From: "Galbreath, Mark" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > > > Use a ListArray and store it as context attribute. > > > > Mark > > > > -----Original Message----- > > From: Sathya Shiv [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, April 30, 2002 8:37 AM > > > > I want to maintain a global String array in servlet. > > I want to store the filenames of unzipped file in a string array and later > > delete the those files accessing the filenames array. > > How do I achieve this??? > > Sathya > > ___________________________________________________________________________ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > > ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
