my dog learned polymorphism*
The moose likes JSP and the fly likes jstl: go backwards on foreach? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jstl: go backwards on foreach?" Watch "jstl: go backwards on foreach?" New topic
Author

jstl: go backwards on foreach?

Phil Smy
Greenhorn

Joined: Sep 25, 2003
Posts: 4
Is there anyway to iterate backwards over a set? i.e. instead of getting items 1 -> 10, I want to go from 10 -> 1.
TIA
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

There is ahandy Collections.reverse(List) method, but isn't too handy when applied to a Set. If you're prepared to step away from JSTL you can use

and you can now iterate the list, which represents the reverse order that would have been returned from the Set.
Dave
Phil Smy
Greenhorn

Joined: Sep 25, 2003
Posts: 4
Thanks Dave, but unfortunately I am iterating over xml data, there is no collection around!
I am doing an x:forEach.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jstl: go backwards on foreach?
 
Similar Threads
Crossing a bridge
WA #1.....word association
do while loop problem
Dare answer this question ???
Rounding up function