Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL algorithm help

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I need to forumulate my algorithm right... I can't seem to think of a better one and the layout of my page gets crazy. I have to do things as follows...


1. Iterate through a list
2. For every record in the list, display information.
3. Only 4 records per row...

I would be easy if I only had to display the records downward.. But I have to make another table row after every 4th record... My tables keep on getting scrammbled, so maybe... If you guys could help... Thank you!


Here's how I do the iteration...



[ June 19, 2006: Message edited by: Bear Bibeault ]
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the html generated, it'll give you a big clue. I'm estamating based on a read through that your <tr> and </tr> are in the wrong order.

Remove the second c:if and change the first one to


You can still have a minor issue with the last row but that should be hard to solve.
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<c:if test="${ ( (status.index % 5) == 0 && (status.index) != 0) }">
</tr>
<tr>
</c:if>


Thanks to your suggestion but...




which actually means the outside if statement will have to be executed first ... Means I have to create a table row first before I could create a table data. But what I actually need is create 4 table data for every row...




I also tried c:when before, but to no luck... I could not figure out the solution...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make it look simpler

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was able to solve the problem by putting it into paper first... I reversed the way I print the table rows...


 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nested tables are BAD!!!

why dont you switch to the DIV layout? http://www.snook.ca/archives/000177.php
[ June 19, 2006: Message edited by: Lynette Dawson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic