You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Boardman <db...@wagpaw.com> on 2001/09/25 00:35:21 UTC
populating an ActionForm using BeanUtils.populate
I am attempting to populate an ActionForm from a ValueObject using
BeanUtils.populate(). The ActionForm has all of the appropriately named
setter methods and attributes, and the ValueObject returns a map with keys
corresponding to the attribute names on the ActionForm. The problem is that
when I place the value of the ValueObject's id attribute (a Long) in the
map, the populate method fails with the following exception:
java.lang.IllegalArgumentException: argument type mismatch
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:986)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:902)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:93
0)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:506)
at
com.integral7.web.durango.CandidateDetailAction.perform(CandidateDetailActio
n.java:118)
It appears that BeanUtils.populate() requires the values in the map to be of
type String or String[], is this true? If so, should I be converting the id
to a String in the ValueObject.toMap() method?
Thanks,
Dave