• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sort issue for logic:iterate

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a map to be iterated inside JSP with logic:iterate tag.

I have a sorted map, but when it is iterated over with logic:iterate tag, the sort order is not working. is there any way to keep the sort order?





messageTypeId is not sorted.. does anybody know why?

Thanks in advance.

[edited to remove smilies and make code more readable --JM]
[ March 28, 2005: Message edited by: Jason Menard ]
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't tell from the code above what's wrong, but I would double check that the map you are putting into the request is in the order you expect it to be in.

Insert the following lines into your action to double check this. This should pretty much simulate the way that the logic:iterate tag iterates through your map.



As a note of explanation... The logic:iterate tag gets an iterator for a Map by getting an iterator over its entrySet. A SortedMap ensures that a set will be in ascending key order according to the natural ordering of its keys or according to a comparator supplied at the creation of the Map. The above code fragment should show whether or not things are being ordered according to their keys as should be expected.
 
I knew that guy would be trouble! Thanks tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic