File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Using Two ArrayLists For One Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Using Two ArrayLists For One Table" Watch "Using Two ArrayLists For One Table" New topic

Using Two ArrayLists For One Table

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I have two ArrayLists. I need ArrayList one to populate column one of my table and ArratList two to populate column two. Here is the code for first part but how do I get the second part to work?

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You have two ArrayLists or an ArrayList of ArrayLists?

If it's the latter, you can nest c:forEach tags like this:

[ July 17, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
Right now I have two separtate ArrayList. If this is not right I am willing to do what ever to correct it.
Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
I think the simple approach is to create an ArrayList with the results of both and then a simple foreach tag will do the job.

Do you see the big picture here?
Now just pass the arraylist tmp to the jsp page and with a single foreach tag you'll do the job

Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
I agree. Here's the link:
subject: Using Two ArrayLists For One Table
Similar Threads
Display Data Records in Table
NestedNullException:Null property value for XXX
Coloring Table Rows
Geting a Cell Content Value
JSTL Iteration for Select Tag is Not Populating Correctly