Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts iterate tag and formatting

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • 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
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest moving to JSTL.



Also see this: http://www-106.ibm.com/developerworks/java/library/j-jstl0318/
 
John Smith
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic