aspose file tools*
The moose likes JSP and the fly likes jstl + forEach + x number of items per row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jstl + forEach + x number of items per row" Watch "jstl + forEach + x number of items per row" New topic
Author

jstl + forEach + x number of items per row

jensen mcjensenson
Greenhorn

Joined: Sep 02, 2006
Posts: 4
I have a list of name Strings. I want to print them out in a table, but three per row. How do I use jstl forEach to do this ?

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

eastwoj Eastwood

Welcome to JavaRanch. We don't have too many rules around here but we do have a Naming Policy. Please read this and adjust your display name accordingly.

Thanks.


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

As to your question, use the varStatus attribute to keep a counter and check that counter in the iteration to determine when to start a new row.
jensen mcjensenson
Greenhorn

Joined: Sep 02, 2006
Posts: 4
thanks! can you show me an example, though? .. i usually end up with this output:

name1, name1
name2, name2
name3, name3
...
...

when i want this:

name1, name2
name3, name4
...


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

"jensen2009 jensen", Gregg's request that you change your display name to adhere to JavaRanch standards was not a suggestion. Valid display names are mandatory for participation on the Ranch. Please change your display name as instructed prior to your next post.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jensen mcjensenson
Greenhorn

Joined: Sep 02, 2006
Posts: 4
Sorry, misread the policy.. any suggestions on my question ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

You apparently missed the "not obviously fictitious" part. Your account is one breath away from being disabled. Please use your real name or at least one that is not obviously not.
jensen mcjensenson
Greenhorn

Joined: Sep 02, 2006
Posts: 4
ok how is this "made up name" any more real than your "made up name" ? this is getting rediculous .. go ahead and disable it. I'll go somewhere else where people are more interested forum activity than jumping through name hoops.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

This isn't about my name, it's about yours. My display name was validated over 13,000 posts ago. It's the name on my office nameplate, and it's the name on my business cards. Can you say the same about yours?

We hate to see you go, there's a lot of value to be had here, and all we ask that you use your real name or at least one that doesn't look like a nose-thumbing at the policy.

E-mail me should you wish your account re-instated.
 
 
subject: jstl + forEach + x number of items per row