Announcement Announcement Module
Collapse
No announcement yet.
question about Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • question about

    I have found that if I put a java list directly in the model map, that it will never get iterated over when I use a <c:forEach, but if i make a bean for that list with getters and setters, it will work just fine. Is this expected behavior?

    Example:
    <spring:bind path="attendeeEntries.attendees">
    <c:forEach items="${status.value}" var="x">
    <b><c:out value="${x.lastName}"/></b><br>
    </c:forEach>
    </spring:bind> ---- that works, but below does not...

    <spring:bind path="attendeeEntries">
    <c:forEach items="${status.value}" var="x">
    <b><c:out value="${x.lastName}"/></b><br>
    </c:forEach>
    </spring:bind>


    In the first example, I am using a wrapper to the list, in the second example, the java.util.List is being put in the model directly. I am using Spring v1.1.3

  • #2
    Hi,

    yes, I'm pretty sure that this is expected.

    What you are actually intending is something like this:

    Code:
    <c&#58;forEach items="$&#123;attendeeEntries&#125;" var="x"> 
    <b><c&#58;out value="$&#123;x.lastName&#125;"/></b><br> 
    </c&#58;forEach>
    As it seems you are not 'binding' to anything, I expect you simply want to put out the elements from the list, don't you?

    Objects you want to <spring:bind> to certainly need to be beans.

    Kind regards,
    Simon

    Comment

    Working...
    X