• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

itrating through an arraylist

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic