Results 1 to 2 of 2

Thread: question about

  1. #1
    Join Date
    Dec 2004
    Posts
    9

    Default 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. #2

    Default

    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

Similar Threads

  1. Forgot password (e.g. secret question) using Acegi
    By lowerymb77 in forum Security
    Replies: 1
    Last Post: Oct 16th, 2005, 10:46 PM
  2. design question: passing context
    By Alarmnummer in forum Management
    Replies: 0
    Last Post: Oct 3rd, 2005, 01:20 PM
  3. Replies: 3
    Last Post: Apr 3rd, 2005, 04:34 PM
  4. Replies: 6
    Last Post: Oct 8th, 2004, 02:21 PM
  5. Question regarding code in UI classes
    By dortman in forum Swing
    Replies: 5
    Last Post: Sep 22nd, 2004, 07:04 PM

Posting Permissions

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