You could have your PeopleBean implement Comparable, which is pretty easy, and then use TreeSet to create a sorted set using your compareTo method.

-nash

On Monday, March 10, 2003, at 01:16 PM, Søren Blidorf wrote:


Hi. I need to sort my collection "people" in alphabetic order by lastname, firstname. Can anybody help me?

I guess I should do it in the Action and not when displayed in jsp page.



Collection people = new ArrayList();

while( rs.next() ) {
PeopleBean pb = new PeopleBean();
pb.setId(rs.getInt("ID"));
pb.setFirstname( rs.getString( "FIRSTNAME" ));
pb.setLastname( rs.getString( "LASTNAME" ));
}

people.add( pb );


Søren Blidorf






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


***********************************************************************
This message is intended only for the use of the intended recipient and
may contain information that is PRIVILEGED and/or CONFIDENTIAL.  If you
are not the intended recipient, you are hereby notified that any use,
dissemination, disclosure or copying of this communication is strictly
prohibited.  If you have received this communication in error, please
destroy all copies of this message and its attachments and notify us
immediately.
***********************************************************************


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to