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

foreach, showing a list like a matrix

 
Danny Garcia
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a list like this,

products = (product01,product02,product03,product04,product05,product06)

And i need show this list like a matrix

product01 product02 product03
product04 product05 product06

I�m using jstl and foreach but i dont know how to solve this problem.

Any hints
Thank
Danny
[ January 03, 2006: Message edited by: Danny Garcia ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming product01, product02, etc are proper beans with getter methods for their properties, you could do something like this:


In this case "activeUsers" is a list of User beans.
 
Danny Garcia
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben, that is not a solutions to my problem. In your solution you are showing activelist like list (one row for one user). I need to show the same activelist like a matrix.

activelist[1].name activelist[2].name activelist[3].name
activelist[4].name activelist[5].name activelist[6].name

Thanks
Danny
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a loop status to check if you have reach the matrix length

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic