May be you can copy all the properties from a map
to an instance of your model class.

You can implement this by
(1)[BeanUtils.populate]
of Apache Commons BeanUtils
See:
http://commons.apache.org/beanutils/apidocs/org/apache/commons/beanutils/BeanUtils.html#populate%28java.lang.Object,%20java.util.Map%29

(2)[BeanWrapperImpl.populate]
of Spring Framework
See:
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/BeanWrapperImpl.html

and

http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/PropertyAccessor.html#setPropertyValues%28java.util.Map%29



These libs may do the data type conversion for you or not.
I am not sure about it.



2010/10/27 Sathish Kumar <sathishkumar.thiyagara...@gmail.com>:
> Hi Li,
>
> Thanks ... Unfortunately, In my case, Map represents various java model
> classes at run time ( User, Employee etc ). So I will get the values in a
> Single Hash Map ( Using BeanUtils.describe )..
>
> But Yes... as you said, By default struts 2 determine the Object Type using
> Type of the attribute. In My case, It is always plain Object :(...
>
> As of now, i process the Map in my action class to do the type conversion.
> just thinking is there any other better way ..
>
> Regards,
> Sathish Kumar T.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to