This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes how to use logic:iterate for ArrayLists withing Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to use logic:iterate for ArrayLists withing Collection" Watch "how to use logic:iterate for ArrayLists withing Collection" New topic
Author

how to use logic:iterate for ArrayLists withing Collection

Ashimashi Kabashi
Ranch Hand

Joined: Sep 11, 2006
Posts: 84
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

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there!

Have you tried the nested logic:iterate tag? What happened?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ashimashi Kabashi
Ranch Hand

Joined: Sep 11, 2006
Posts: 84
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
134

Ashimashi,
You would use nested logic:iterate tags. The outer one would use the java.util.ArrayList type. The inner one would use String.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ashimashi Kabashi
Ranch Hand

Joined: Sep 11, 2006
Posts: 84
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
134

That is close. I was thinking more like:


[edited to fix typo in name]
[ October 12, 2008: Message edited by: Jeanne Boyarsky ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use logic:iterate for ArrayLists withing Collection
 
Similar Threads
Dynamic number of input fields.
how do I use vector
nested beans - setting values in form
How to write retrieved data into javascript Array?
displaying data from arrays with html:text