wood burning stoves*
The moose likes Struts and the fly likes logic:iterate ..collection data sorting in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:iterate ..collection data sorting in struts" Watch "logic:iterate ..collection data sorting in struts" New topic
Author

logic:iterate ..collection data sorting in struts

Dattatray Sutar
Ranch Hand

Joined: Jul 12, 2006
Posts: 46
Hi all..
I m using tomcat , struts. Is there any standard function that sorrts the columnwise data of a perticular collection.

e.g. I m using <logic:iterate>...<bean:write>...
any parameter that "iterates" through the collection as per the user wants.

Thanks a lot.


with regards<br />Datta.<br /> <br />To the world you might be one person, but to one person you just might be the world !
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here are some options:

1-Sort the list using the Collections.sort() method in your action class prior to displaying the JSP.This link shows an example of how to do this.

2-If the list is being created from a database, use the "order by" clause in your SQL to see that the rows are retrieved in the order you want.

3-Use one of the many JavaScript packages that create a sortable HTML table. These packages will usually allow you to sort by any column by clicking on the column header.


Merrill
Consultant, Sima Solutions
Dattatray Sutar
Ranch Hand

Joined: Jul 12, 2006
Posts: 46
Originally posted by Merrill Higginson:
Here are some options:

1-Sort the list using the Collections.sort() method in your action class prior to displaying the JSP.This link shows an example of how to do this.

2-If the list is being created from a database, use the "order by" clause in your SQL to see that the rows are retrieved in the order you want.

3-Use one of the many JavaScript packages that create a sortable HTML table. These packages will usually allow you to sort by any column by clicking on the column header.



Thanks a lot for the help..it pointed me in the right direction.
 
Don't get me started about those stupid light bulbs.
 
subject: logic:iterate ..collection data sorting in struts
 
Similar Threads
nested beans - setting values in form
problem with logic:iterate
Using collection attribute of logic:iterate
Is my use of c:if correct ?
Problems with Indexed Properties