PDA

View Full Version : Is java.util.HashMap supported as a command Class?


2devnull
08-17-2004, 12:42 PM
Can java.util.HashMap be a command class? I get validation errors since it has no getters or setters. Is there a way around this?

org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'email' of bean class [java.util.HashMap]: Property 'email' is not readable
at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:489)
at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:483)
at org.springframework.validation.BindException.rejec tValue(BindException.java:150)
at com.site.web.UserRoleUpdController.onBindAndValida te(UserRoleUpdController.java:110)

Colin Sampaleanu
08-17-2004, 01:07 PM
No. Any java class can be a command object, but it should be a JavaBean in terms of settings properties on it.

Regards,

Keith Donald
08-17-2004, 01:16 PM
With that said, you could likely put together some custom binding code that binds request parameters to a map. I imagine such custom binding strategies would be useful in other scenarios as well, for example, binding request parameters to an xml document. The hooks are there to do it.

Are we planning to support additional data binding strategies out of the box in the future? I know that's one of the things we've been pushing for in rich client with its data binding framework, which is (because it has to be) a bit more involved than Spring MVC's binding infrastructure.

2devnull
08-17-2004, 01:26 PM
Thanks. Thats what I thought. Just wanted to confirm.