views:

31

answers:

2
+1  Q: 

Checkbox Binding

I am getting error message

org.springframework.beans.NotReadablePropertyException: Invalid property 'produts[0]' of bean class [java.util.HashMap]: Bean property 'produts[0]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

when i perform following in jsp file

<c:forEach items="${model.products}" var="prod"> varStatus="loop">
  <tr>
  <td align="center">
    <form:checkbox path="produts[${loop.index}].selected"></form:checkbox>
  </td>
  <td><c:out value="${prod.description}"/> </td>
  <td>$<c:out value="${prod.price}"/></td>
  </tr>
</c:forEach>

products is populated by List<Product> getProducts(); in another class.

What i am doing wrong?

+1  A: 

Looks like a typo to me:

produts[${loop.index}]

should be

products[${loop.index}]
skaffman
It is a typo but i am getting same error messageorg.springframework.beans.NotReadablePropertyException: Invalid property 'products[0]' of bean class [java.util.HashMap]: Bean property 'products[0]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
Omkar
+1  A: 

Since you are already in the forEach loop, why cant you just use '${prod.selected}' instead of products[${loop.index}].selected?

Sasi
i cannot use it because it does not work either.
Omkar