Results 1 to 2 of 2
  1. #1
    peace76 is offline Member
    Join Date
    Apr 2010
    Posts
    18
    Rep Power
    0

    Default array of array, nesled <c:foreach> possible?

    Hi thanks for taking the time.

    I would be greateful if someone could help me out here.

    How can I display the data from two database tables in the same <c:forEach> loop?

    Some background information :

    controller.java
    Java Code:
    List one <---- contains a list of many Entity.Users
    List two <---- contains a list of many users Entity.Choice
    
    request.setAttribute("users", one);
    request.setAttribute("choice", two);
    The problem is I need to get information from both Entitys above in the same <c:forEach> loop

    works. but not in the way I want =)
    Java Code:
    <c:forEach var="one" items="${one}">
      ${one.id}
     <c:forEach var="two" items="${two}">
      ${two.id}
    </c:forEach></c:forEach>
    It obivus I need to solve this inside the controller. So i tryed to

    Java Code:
    List one <---- contains a list of many Entity.Users
    List two <---- contains a list of many users Entity.Choice
    
    List three = new ArrayList();
    three.add(one);
    three.add(twi);
    request.setAttribute("three", three);
    But I cant get it to work. What is the best approach ? Im new to this and any help is really appreciated

    / greating Peace
    Last edited by peace76; 12-04-2010 at 11:12 AM.

  2. #2
    peace76 is offline Member
    Join Date
    Apr 2010
    Posts
    18
    Rep Power
    0

    Default

    This problem was a realationship issue.

    Thanks to "gcalvin" in another thread I solved this one too.

    / peace

Similar Threads

  1. Replies: 23
    Last Post: 09-07-2010, 09:12 PM
  2. Replies: 2
    Last Post: 09-06-2010, 02:03 AM
  3. Array length and printing out uninitialized array.
    By nicolek808 in forum New To Java
    Replies: 4
    Last Post: 09-10-2009, 10:12 AM
  4. Replies: 1
    Last Post: 03-31-2009, 07:40 AM
  5. How to use Foreach on an Array
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 12:06 AM

Posting Permissions

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