Enjoying Life ...... !
If u can look into my eyes, u will see how beautiful the life is.
posts - 4,comments - 12,trackbacks - 0

讨论编写复杂struts标签时,需要在已知对象和其属性名称的情况下取得该对象中对应的属性值。但是对于传过来的数据并不知道其数据类型,即时使用Object.getClass()得到其数据类型,也不可能提前引入相关的类。将strutslogic.iteratebean:write反编译后详细研究,得到下列代码:

Object propertyValue = PropertyUtils.getProperty(object, propertyName)

object为对象,propertyName为需要得到的属性名称,返回的是该对象中对应属性的值。试验可以使用。

posted on 2005-05-25 15:42 lippea'blog 阅读(628) 评论(1)  编辑  收藏

FeedBack:
# re: 取未知类型对象的属性值
2008-05-04 15:31 | ccc
PropertyUtils是什么?  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: