• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Starting new row after every 4 table cells using c:forEach

 
Mike Dell
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am stuck on how I can get this to work. What I have at the moment is always missing a closing </tr> somewhere. I'd appreciate any pointers on this.

Here is what I have so far:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way I'd do it is to just test whether a multiple has been reached and insert "</tr><tr>" into the template text.
 
Mike Dell
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The way I'd do it is to just test whether a multiple has been reached and insert "</tr><tr>" into the template text.


Thanks! That worked in terms of getting the tags right. But now, I've noticed another thing...

<c:when test="<%=status.getCount()%5==0%>"> doesn't work quite the way I want it to when the count gets above 8.
For example, when it is displaying the 9th cell item, 9%5 is not 0 so it remains on the second row instead of going to the 3rd row. What is the proper test condition here?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you still using scriptlets? The JSTL is better meant to use the EL. That'd be the first step to fixing any problems in my opinion.

(Unless you are still, for whatever reasons, stuck on JSP 1.2? )
 
Mike Dell
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why are you still using scriptlets? The JSTL is better meant to use the EL. That'd be the first step to fixing any problems in my opinion.

(Unless you are still, for whatever reasons, stuck on JSP 1.2? )


Thanks for your suggestion. I removed the scriptlets and was able to get it working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic