Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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
Hang a left on main. Then read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!