A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© 史晓霞 黑马帝   /  2011-11-18 13:39  /  1546 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

        @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());
                }

2 个回复

倒序浏览
一头雾水,你这是要实现什么功能,设置properties??你不写全我们没法帮你
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马