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. On Wed, Oct 27, 2010 at 2:17 PM, Li Ying <liying.cn.2...@gmail.com> wrote: > Your data is declared as HashMap<String,Object> > So Struts2 don't know what data type the parameter should be converted to. > > My suggestion: > > Change your Action class likes: > Public Class ActionClass{ > private *HashMap<String, Date>* userPropsAsDate; > > private *HashMap<String, Integer>* userPropsAsInt; > > private *HashMap<String, String>* userPropsAsStr; > > // Setter and Getter > } > > And use the appropriate map for particular data type. > > BTW, I didn't test it. > You can try it and see if it works. > > > > 2010/10/27 Sathish Kumar <sathishkumar.thiyagara...@gmail.com>: > > Hi Group, > > > > > > > > I have a below issue with Data Binding. Consider we have below code > > > > > > > > //Model Class > > > > Public Class User { > > > > Private *Date* dateOfBirth; > > > > // Setter and Getter > > > > } > > > > > > > > // Action Class > > > > Public Class MyActionClass{ > > > > Private *User* user ; > > > > // Setter and Getter > > > > } > > > > > > > > In My HTML I use a Date Picker component as below …. > > > > > > > > [...@sj.datepicker name="*user. dateOfBirth* " label="Date Of Birth" /] > > > > > > > > Everything works fine !!! and I see *dateOfBirth populated with > > java.util.Date* > > > > > > > > But …. In some cases , My Action Class is generic .. so I have to use a > > HashMap to store the values .. > > > > > > > > // Action Class > > > > Public Class MyProblematicActionClass{ > > > > Private *HashMap<String,Object>* userAsMap ; > > > > // Setter and Getter > > > > } > > > > > > > > And HTML as, > > > > > > > > [...@sj.datepicker name=" *userAsMap. dateOfBirth* " label="Date Of Birth" > /] > > > > > > > > But this time, userAsMap. *dateOfBirth is populated as String value > rather > > than Date* value ….. > > > > > > > > Is this problem solvable ? if yes, how do we do that ? > > > > > > > > Any help here will be great ….. > > > > > > > > Thanks & Regards, > > > > Sathish Kumar T > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >