// 获取 ActionForm 表单数据
UserActionForm uForm = (UserActionForm) form;
// 构造一个User对象
User user = new User();
// 赋值(部分 ==》 整体)
BeanUtils.copyProperties(uForm,user);
注意点
1、UserActionForm ==》User:部分到整体;
2、如果User和UserActionForm 间存在名称不相同的属性,则BeanUtils不对这些属性进行处理,需要手动处理;
3、慎用BeanUtils.copyProperties;若属性较少,则建议直接Get/Set
参考文章
【1】https://blog.csdn.net/Mr_linjw/article/details/50236279
- copyProperties BeanUtilscopyproperties beanutils copyproperties拷贝beanutils对象 copyproperties拷贝beanutils建议 copyproperties beanutils list 我的女神copyproperties毒药beanutils 物流技术copyproperties拷贝beanutils copyproperties beanutils类型 工具 序列copyproperties serializable beanutils 拷贝copyproperties beanutils还是 写法copyproperties beanutils spring