This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes forEach and hasNext() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "forEach and hasNext()" Watch "forEach and hasNext()" New topic
Author

forEach and hasNext()

Max Rahder
Ranch Hand

Joined: Nov 06, 2000
Posts: 177
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

Joined: Jan 10, 2002
Posts: 60740
    
  65

Check out the varStatus attribute of the forEach tag.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Max Rahder
Ranch Hand

Joined: Nov 06, 2000
Posts: 177
Works great. Thanks for the tip.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forEach and hasNext()
 
Similar Threads
Difficulty Using checkboxes in JSF
forEach var
Convert List to comma delimited string
Generics Enum type values?
Counting nodes using xsl:key