• 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

Struts iterate tag and formatting

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have returned a collection of objects and am using the iterate tag to loop through them and display there names in a table.

However, intsead of displaying them like this:
onject 1
object 2
object 3
object 4

I would like to display them as this

object 1 object 2
object 3 object 4

Does anyone know of a good way of doing this?

Is there anyway you can specify if commands in the iterate tag and access the counter used by the tag?
This way I could test the following

if(counter mod 2 == 0) then insert new row

thank you

david
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest moving to JSTL.



Also see this: http://www-106.ibm.com/developerworks/java/library/j-jstl0318/
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah the jstl c:forEach works or you can use the index attribute in your current logic:iterate, you can do your mod test on that
 
reply
    Bookmark Topic Watch Topic
  • New Topic