Announcement Announcement Module
Collapse
No announcement yet.
dynamic list binding and jstl foreach Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic list binding and jstl foreach

    I have some objects in a hashset rather than a list. Can I bind to values in these objects directly using code like ...

    Code:
    <c:forEach items="${object.items}" var="item" varStatus="status">
          <tr>
            <td><c:out value="${item.attr1}"/> </td>
            <td><c:out value="${item.attr2}"/> </td>
            <td>
            <form:radiobutton path="items[${status.index}].selected"/>
            </td>
          </tr>
    </c:forEach>
    where the object.items is a hashset rather than list. when I try to do this I get an error:

    org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'items[0]' of bean class [au.com.prolancer.hsp.dto.ServiceProfileDTO]: Bean property 'items[0]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

  • #2
    You can only bind to indexed collections (i.e. an array or List). A set isn't indexed.

    Comment


    • #3
      Thank you good sir ...

      Comment


      • #4
        Hi,

        can can accomplish the exact same result with a struts tags?
        i mean the dynamic list binging using logic:iterate

        Comment

        Working...
        X