BeanUtils.populate的作用
来源:互联网 发布:天猫淘宝店费用预算 编辑:程序博客网 时间:2024/05/22 05:15
BeanUtils.populate的作用
转自: http://blog.sina.com.cn/s/blog_84f5d20b0100tyuw.html首先,它是在org.apache.commons.beanutils.BeanUtils包中的一个方法。
InsuranceInfo info = new InsuranceInfo(); (这是一个javabean) BeanUtilities.populateBean(info, request);
方法的作用:用来将一些 key-value 的值(例如 hashmap)映射到 bean 中的属性。
servlet中有这样的使用:
先定义form表单内容的Info对象(当然你要先写一个bean,这个bean中包含form表单中各个对象的属性)
——> populateBean(info, request.getParameterMap());(先将request内容转为Map类型)
——>BeanUtils.populate(info, propertyMap);(调用包中方法映射)
映射的过程就是将页面中的内容先用request获得,然后再将之转换为Map(这里用request.getParameterMap())
最后使用BeanUtils.populate(info,map)方法将页面各个属性映射到bean中。之后我们就可以这样使用bean.getXxxx()来取值了。
0 0
- BeanUtils.populate的作用
- BeanUtils.populate的作用
- BeanUtils.populate的作用
- BeanUtils.populate的作用
- BeanUtils.populate的作用 !
- BeanUtils.populate的作用
- BeanUtils.populate的作用
- BeanUtils.populate的作用
- BeanUtils.populate的作用
- BeanUtils.populate的作用
- BeanUtils.populate(obj,map)的作用
- BeanUtils.populate的作用-注册页面
- BeanUtils.populate的用法
- BeanUtils.populate的用法
- 解决 BeanUtils.populate 的问题
- 关于BeanUtils.populate的解决
- BeanUtils.populate
- BeanUtils.populate
- hdoj1002A + B Problem II
- ArcSDE
- 关于sysctl.conf配置对网络连接数的优化
- ArcGIS GeoDataBase GeoDataset dataset
- python学习——SMTP发送邮件
- BeanUtils.populate的作用
- Java内存结构
- HDAC
- Spring系列之IOC
- Android LayoutInflater原理分析,带你一步步深入了解View(一)
- Delete Files Older Than x Days on Linux
- 【9001】Internet消息发布
- 文件的访问权限控制
- 数据库时间段查询