Hope this helps :

public class Bean {


        private String[] array;



        public String[] getArray() {
                return array;
        }


        public void setArray(String[] array) {
                this.array = array;
        }

}



____________________________________


import org.apache.commons.beanutils.PropertyUtils;
import java.util.HashMap ;

public class Test2 {

        public static void main(String[] args) throws Exception{

                Bean bean = new Bean();
                HashMap mp = new HashMap();
                mp.put("array",new String[]{"1","2","3"});
                bean.setArray(new String[]{"1","2","3"});


                Bean bean2 = new Bean();
                Bean bean3 = new Bean();

                PropertyUtils.copyProperties(bean2, bean);

                System.out.println(bean2.getArray());

                PropertyUtils.copyProperties(bean3, mp);

                System.out.println(bean3.getArray());



        }
}



Ivan

-----Original Message-----
From: Patrick Scheuerer [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 01, 2004 11:48 PM
To: Struts Users List
Subject: Problem with BeanUtils.copyProperties()


Hi,

Is it not possible to copy a String[] using BeanUtils.copyProperties()?

My DynaValidatorForm has a field property like:

        <form-property
                name="someProperty"
                type="java.lang.String[]"
        />

My Business Bean has the following method:

        public void setSomeProperty(String[] data){
        }

Every time the copyProperty() method is called it throws the following
exception:
java.lang.IllegalArgumentException: argument type mismatch

Can somebody help me out?

Thanks! Patrick


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



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

Reply via email to