• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Joe Ess
  • salvin francis

sort list using select and optionsCollection

Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I want to sort the list in the following select on the empName property, can I do that using struts.

If not please let me know how to do it with a sample code.

<html:select property="employeeListSelection">
<html ptions collection="employeeRoListWithAllInstances" property="empId" labelProperty="empName"/>

Help is appreciated .

Thanks in advance

Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have several options for sorting lists, depending on where the data is coming from. If you are getting the data from a database, that is the easiest and most efficient place. You an also sort the data in your business tier or in your form class. Implementing a Comparator and using the method Collections.sort is one of the easiest ways. Some of the sorted collection classes can be used as well.

- Brent
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!