Do it in the query.

select ID, FIRSTNAME, LASTNAME from people order by LASTNAME, FIRSTNAME

robert

> -----Original Message-----
> From: Søren Blidorf [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 10, 2003 1:17 PM
> To: [EMAIL PROTECTED]
> Subject: Sort a collection in alphabetic order
>
>
>
> 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]
>


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

Reply via email to