Details
-
Type:
Bug
-
Status: Waiting for Feedback
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 2.3.0
-
Fix Version/s: None
-
Component/s: Binding: Type Conversion System
-
Labels:
Description
The Binding model cannot find proper converting property editor when binding to an array of custom type.
The 'findSpringConvertingPropertyEditor' method of BindingModel finds a TypeDescriptor of types.CustomType[] when perhaps it should be types.CustomType?
this occurs when trying to bind multiple checkboxes to an array property.
ex.
Model:
public class Model { private MyType[] options = {MyType.TYPE_1, MyType.TYPE_2}; private MyType[] selected; // getter & setters }
View - jsp file
.... <c:forEach items="${model.options}" var="option"> <form:checkbox path="selected" value="${option}" id="selected${option}" /> <label for="selected${option}"><spring:message message="${option}" /></label> </c:forEach>
–
Notes: The value option prints out the toString() method of the MyType class (because it cannot find the proper converter)
The same model/jsp and converters bind properly when using the Spring MVC binder.
The converter works because using a hidden input tag <form:hidden path="oneSelected" /> will bind properly if oneSelected is a field of type MyType.