• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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
    Bookmark Topic Watch Topic
  • New Topic