aspose file tools*
The moose likes Struts and the fly likes itrating through an arraylist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "itrating through an arraylist" Watch "itrating through an arraylist" New topic
Author

itrating through an arraylist

Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 81
Hi All,

I have an ArrayList, which consists two beans. I want to iterate through it and print the values. Can you please explain me as how I would do it using <logic:iterate> and <bean:write>


Thanks,
Dinakar.K
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181


This assumes your form is called myForm and it has a method called "getArrayList()". It also assumes that the objects in the array list have a "getValue()" method.

I'm not clear on what you mean by "I have an ArrayList, which consists two beans".
Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 81
I am not using a form. I have got some fields from database(resultset) which I inserted into a bean. This bean is again added to an ArrayList. I,then, placed the ArrayList in request scope. Now, I am trying to loop through the ArrayList in jsp page.

Any idea towards helping me solve this is highly appreciated.

Thanks
Dinakar.K
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181


Where "myArrayList" is the name you put the array list into request scope under, and where your array list contains objects that have a "getValue()" method.
 
wood burning stoves
 
subject: itrating through an arraylist
 
Similar Threads
Question on Whizlabs Test Question
Usage of wildcard?
Wild card generic type
The use of ? extends
how to add an array to an ArrayList