@Test
public void test2() throws Exception
{
String name="wangwu";
String password="123";
String age="15";
String birthday="1990-10-13";
ConvertUtils.register(new DateLocaleConverter(), Date.class);
Person p=new Person();
BeanUtils.setProperty(p, "name", name);
BeanUtils.setProperty(p, "password", password);
BeanUtils.setProperty(p, "age", age);
BeanUtils.setProperty(p, "birthday", birthday);//只支持8种基本类型
System.out.println(p.getName());
System.out.println(p.getPassword());
System.out.println(p.getAge());
Date date=p.getBirthday();
System.out.println(date.toString());
} |
|