commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Scott <ryansc...@trentu.ca>
Subject StringArray
Date Wed, 26 Nov 2003 19:41:15 GMT
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


Mime
View raw message