• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Using Two ArrayLists For One Table  RSS feed

 
Ranch Hand
Posts: 1889
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Steve Dyke
Ranch Hand
Posts: 1889
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right now I have two separtate ArrayList. If this is not right I am willing to do what ever to correct it.
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Example:

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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!