You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Laurent Perez <ha...@gmail.com> on 2004/12/09 21:01:41 UTC

Sorting elements before jx:forEach ?

Hello

Is it possible to directly sort elements (say, by some random bean
property) within the JXTemplate itself before looping over an
ArrayList received from a flowscript with <jx:forEach>, or is the best
practice to sort them before they reach the JXTemplate ? And if so,
how would you sort them within a flowscript ?

Thanks for any advice

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Sorting elements before jx:forEach ?

Posted by Adam Ratcliffe <ad...@mrigitech.com>.
Hi Laurent

You can use the java.util.Collections class to sort a list using either the
natural ordering of the elements or by supplying a Comparator.  You just
need to import these classes into your flowscript to use them.

Cheers
Adam

-----Original Message-----
From: Laurent Perez [mailto:hakimm@gmail.com]
Sent: Friday, 10 December 2004 9:02 a.m.
To: users@cocoon.apache.org
Subject: Sorting elements before jx:forEach ?


Hello

Is it possible to directly sort elements (say, by some random bean
property) within the JXTemplate itself before looping over an
ArrayList received from a flowscript with <jx:forEach>, or is the best
practice to sort them before they reach the JXTemplate ? And if so,
how would you sort them within a flowscript ?

Thanks for any advice


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org