File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes EL algorithm help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "EL algorithm help" Watch "EL algorithm help" New topic

EL algorithm help

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
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 ]

SCJP 1.5
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
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.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
<c:if test="${ ( (status.index % 5) == 0 && (status.index) != 0) }">

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é

Joined: Nov 24, 2005
Posts: 14688

Make it look simpler

[My Blog]
All roads lead to JavaRanch
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
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

Joined: Aug 25, 2005
Posts: 536
nested tables are BAD!!!

why dont you switch to the DIV layout?
[ June 19, 2006: Message edited by: Lynette Dawson ]

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
I agree. Here's the link:
subject: EL algorithm help
jQuery in Action, 3rd edition