For a resizable list from an array, try:

List stringList = new ArrayList(Arrays.asList(stringArray));

Quoting Wendy Smoak <[EMAIL PROTECTED]>:

> > From: Mark Lowe [mailto:[EMAIL PROTECTED] 
> > It was working, until i rearranged a few things. A few 
> > questions/suggestions in help me problem solve would be greatly 
> > appreciated if you have the time.
> 
> I also don't see why BeanUtils can't handle turning multiple request
> parameters with the same name into an ArrayList.  It *seems* like it
> should work.
> 
> String[] works fine for me, though.  I actually thought there was a
> one-liner to turn a String[] into an ArrayList of Strings, but I was
> mistaken-- Arrays.asList() only produces a fixed-length list.  You can
> change values, but you can't add a value to the array-backed-List.  My
> "issue" is probably not one that you have-- I need to accept input from
> three text areas and manually add the concatenated text to the String[]
> property.  
> 
> It would be nicer to do it with myList.add( "stuff" ), but since I can't
> get ArrayList to work, here's how I'm using String[] in Action code:
> 
>       DynaActionForm dForm = (DynaActionForm) form;
>       String[] accounts = (String[]) dForm.get( "accounts" );
>       String fund = dForm.getString( "fund" );
>       String function = dForm.getString( "function" );
>       String costCenter = dForm.getString( "costCenter" );
>       String[] newArray = new String[ accounts.length + 1];
>       System.arraycopy( accounts, 0, newArray, 0, accounts.length );
>       newArray[ newArray.length - 1 ] =
> fund+"_"+function+"_"+costCenter;
>       dForm.set( "accounts" , newArray );
>       accounts = null;
>       return mapping.findForward( "advanced" );
> 
> I haven't used arrays in ages, so if someone is now ROFL at my
> incredibly inefficient code, please enlighten me.
> 
> -- 
> Wendy Smoak
> Application Systems Analyst, Sr.
> ASU IA Information Resources Management 

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to