Hi,

I agree with all of the above comments. You may like to use them in
different scenarios:
1. DB sort using "order by" but each request will cost your db access
connection
2. Sorting in DAO is good
3. Soring in any case (at JSP/Business layer/DAO) require you to do some
comparison , you can create a custom code implementing the "Comparator" or
try looking  the Jakarta Commons utility -BeanComparator -
http://builder.com.com/5102-6386-5029658.html

At the same time, if you want to display this as some table on the web page,
you may want to look at the DisplayTag
http://displaytag.sourceforge.net/11/.,
http://demo.appfuse.org/appfuse/demos/users-edit.jsp
This will have sorting, as well as paging fuctionality.

Thanks and Regards,
Thomas Joseph
Kott Software Pvt. Ltd. | Vallamattom Estate | M.G.Road | Cochin, Kerala -
682015 | India
www.kottsoftware.com
----------------------------------------------------------------------------
----
This email (including any attachments) is subject to copyright, the
information in it is confidential, and it is legally privileged. Use of this
email or of any information in it other than by the addressee is
unauthorized and unlawful. If you are not the intended recipient of the
mail, kindly notify the author of the mail and delete the
same. ----------------------------------------------------------------------
----------
It doesn't matter how you were, but rather how you are that decides your
future. A right attitude will get you to Success.

----- Original Message -----
From: "Strachan, Paul" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Tuesday, September 26, 2006 12:52 PM
Subject: RE: sort the list


You could create your own sort class which implements
java.util.Comparator

e.g.

public class MySort implements Comparator {

compare(o1, o2) {
String name1 = (String) o1.getLastName();
String name2 = (String) o2.getLastName();
return name1.compareTo(name2);
}

}

then:

MySort sort = new MySort();
Collections.sort(myList, sort);

---------------------------------------------------------------------
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