Hi,
I've read previous questions about this, and looked at the code, and seem to be doing everything right, but my property editor is not being called (CustomBooleanEditor is called instead).
The log contains:
So it's clear that:Code:[MemberContactsController] - initBinder: ... ... [CachedIntrospectionResults] - Found property 'editable' of type [boolean] ... [BeanWrapperImpl] - Converting String to [boolean] using property editor [org.springframework.beans.propertyeditors.CustomBooleanEditor@18a79e] ... [MemberContactsController] - Data binding errors: 1 ... ... Failed to convert property value of type [java.lang.String] to required type [boolean] for property 'contacts.addresses[0].editable'; ... [JspServlet] - Request Params: ... locale = en ... theme = simple ... contacts.addresses[0].editable = Edit ... show = contacts
- the value "Edit" is being assigned to a field "editable" which should be boolean
- that initBinder is being called.
In initBinder I register my property editors (in a subclass of SimpleFormController):
And the property editor includes logging info that is never seen:Code:@Override protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { logger.debug("initBinder: " + binder); binder.registerCustomEditor(java.lang.Boolean.class, "editable", new SubmitPropertyEditor()); binder.registerCustomEditor(java.lang.Boolean.class, new SubmitPropertyEditor()); }
Any idea what is going wrong?!Code:@Override public String getAsText() { logger.debug("getAsText: " + getValue()); return null == getValue() ? "" : getValue().toString(); } @Override public void setAsText(String value) { logger.debug("setAsText: " + value); setValue(Boolean.TRUE); }
Thanks,
Andrew


Reply With Quote