Results 1 to 4 of 4

Thread: dynamic list binding and jstl foreach

Hybrid View

  1. #1
    Join Date
    May 2008
    Posts
    25

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    You can only bind to indexed collections (i.e. an array or List). A set isn't indexed.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    May 2008
    Posts
    25

    Default

    Thank you good sir ...

  4. #4
    Join Date
    Nov 2008
    Posts
    2

    Default

    Hi,

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •