• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

EL algorithm help

 
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make it look simpler

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...


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