You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ryan Scott <ry...@trentu.ca> on 2003/11/26 20:41:15 UTC

StringArray

I have an array of strings that I would like to copy over to a bean that 
uses a map using BeanUtils.setProperty;
When I do this, the first element of the array is converted to a String 
and this is the value for my key.  How do I go about getting the
whole array assigned to the key instead of the first element?

Thanks
Ryan



***My bean***
public class Foo {

    private HashMap values = null;
   
    public Foo(){
        values = new HashMap();
    }
   
    public void setValue(String key, Object value){
           values.put(key, value);
       }
       public Object getValue(String key){
           return values.get(key);
       }
}

*** My test ****

public class TestBeanUtils {

    public static void main(String[] args) throws Exception {
        Object value = null;
        Foo foo = new Foo();
        String[] test = {"1","2","3"};
        BeanUtils.setProperty(fooForm, "value(ryan)", test);
    }
}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org