Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

itrating through an arraylist

 
Ram Kas
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic