Omkar
Omkar

Reputation: 11

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?

Upvotes: 1

Views: 1598

Answers (2)

Sasi
Sasi

Reputation: 757

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

Upvotes: 1

skaffman
skaffman

Reputation: 403481

Looks like a typo to me:

produts[${loop.index}]

should be

products[${loop.index}]

Upvotes: 1

Related Questions