I want to sort the list in the following select on the budgetName property, can I do that within struts? If not and I sort the list of javabeans in the collection before going onto the page, is it guaranteed that the beans would be accessed in order?
Any suggestions would be appreciated thanks B [smilies disabled by moderator] [ October 24, 2003: Message edited by: Junilu Lacar ]
If budgetlist is a List, call the Collections.sort() method. You have two choices: 1) Implement the Comparable interface for the class of objects stored in your collection (Budget class?) or 2) Use the overloaded sort() method which accepts a Comparator For approach 1), add this line to your code which retrieves the budgetlist: Collections.sort(budgetlist); -Mark
posted 16 years ago
I thought there might be some struts way I could include which property to sort on. Mark, your 2nd approach seems to be what I need, I'll write a comparator class. Thanks for the replies all. B
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!