> Hi all , > > > In a action class i have List of FormBeans. I want to have this formbean > sorted on one of its parameter say String name . > > I have a java comparator say NameComparator which implements comparator > interface so i implemented method compare(Object o1 , Object o2 ) to compare > the name attribute of formbean . > > Then I perform Collections.sort(list , nameComparatorObject ) > where NameComparator nameComparatorObject = new NameComparator(); > > But still the list of form beans are sorted by name. > > any suggestions ?
What you described looks like it will work, which is probably why your post went unanswered. I recommend using the the following call. I am assuming that the name property in the formBean is a String. List list = getYourList(); String fieldName = "name"; java.util.Collections.sort(list, new org.apache.commons.beanutils.BeanComparator(fieldName ,String.CASE_INSENSITIVE_ORDER)); > > Regards, > Jagan. > Ben --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]