Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use logic:iterate for ArrayLists withing Collection

 
Ashimashi Kabashi
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Ranchers.

I am having a little trouble with this.
I am trying to use the logic:iterate tag to iterate through a Collection. But the Collection does not have the values itself. The Collection is a collection of ArrayLists and the ArrayLists have the Strings which I want to display.

What do I need to do on the jsp page?
Do I need a nested logic:iterate?

Your help is always appreciated!!
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!

Have you tried the nested logic:iterate tag? What happened?
 
Ashimashi Kabashi
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am struggling with that actually..
I know how to do this if the Collection had the actual string values etc.
But the Collection has arraylists and the arraylists have the string values..

my code is
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashimashi,
You would use nested logic:iterate tags. The outer one would use the java.util.ArrayList type. The inner one would use String.
 
Ashimashi Kabashi
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I do something like this (while populating the Collection)

where PlatformVO is a bean that I am using
and represent it like this (on the jsp):



Then everything is fine....

But I dont want to fill the Collection with Beans..I want to fill it with ArrayLists, the reason is the that when you use a bean you have to use the property attribute and are bound to use only the attributes defined in the bean. But I dont want to be bound to the bean as my arraylist contains other columns.

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is close. I was thinking more like:


[edited to fix typo in name]
[ October 12, 2008: Message edited by: Jeanne Boyarsky ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic