This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

forEach and hasNext()  RSS feed

 
Max Rahder
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I translate this into forEach? The part I can't figure out is the code that omits the delimiter for the last item:

Java version:

This sample prints something like: "Groucho, Harpo, Chico"



JSTL version:

How do I put the "has next" test inside the forEach tag?

This sample prints something like: "Groucho, Harpo, Chico, "
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the varStatus attribute of the forEach tag.
 
Max Rahder
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works great. Thanks for the tip.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!