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());
// System.out.println(p.getBirthday());
Date date=p.getBirthday();
System.out.println(date.toLocaleString());
出现的错误是:
2011-11-15 21:54:32 org.apache.commons.beanutils.locale.converters.DateLocaleConverter getFormatter
警告: Null pattern was provided, defaulting to: yy-M-d ah:mm |