Results 1 to 2 of 2
- 12-04-2010, 09:36 AM #1
Member
- Join Date
- Apr 2010
- Posts
- 18
- Rep Power
- 0
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
The problem is I need to get information from both Entitys above in the same <c:forEach> loopJava 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);
works. but not in the way I want =)
It obivus I need to solve this inside the controller. So i tryed toJava Code:<c:forEach var="one" items="${one}"> ${one.id} <c:forEach var="two" items="${two}"> ${two.id} </c:forEach></c:forEach>
But I cant get it to work. What is the best approach ? Im new to this and any help is really appreciatedJava 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);
/ greating PeaceLast edited by peace76; 12-04-2010 at 10:12 AM.
- 12-07-2010, 09:40 PM #2
Member
- Join Date
- Apr 2010
- Posts
- 18
- Rep Power
- 0
Similar Threads
-
Variable of an object in an array compared to an element of another array?
By asmodean in forum New To JavaReplies: 23Last Post: 09-07-2010, 08:12 PM -
Trying to make an array list // inserting an element to middle of array
By javanew in forum New To JavaReplies: 2Last Post: 09-06-2010, 01:03 AM -
Array length and printing out uninitialized array.
By nicolek808 in forum New To JavaReplies: 4Last Post: 09-10-2009, 09:12 AM -
How to add an integer to a array element and the store that backinto an array.
By Hannguoi in forum New To JavaReplies: 1Last Post: 03-31-2009, 06:40 AM -
How to use Foreach on an Array
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 11:06 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks