Subject: Re: Logic:Iterate:sort, what do you think?
From: "Andrej" <[EMAIL PROTECTED]>
 ===
Michael,

this may be a useless note, but if you want to sort a Collection, you can
use the Comparable interface then the Collection.sort() method. IMHO,
sorting is a "process" and should theoretically not be handled by the JSP
(ie the "view").

In other words, the Collection that you send to the view should already be
sorted.

But I know it doesn't answer your question.. :)

Andrej

"Michael Marrotte" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> I'm looking for sorting support for the Struts Logic Iterate tag. Struts
> Layout by Improve claims to support something like this for their
Collection
> library.  However, I found their latest release (docs and examples) in
> disarray.  Also, in the archives I see a message (RE: sorting in
> logic:iterate) from Tim Sawyer where he claims to have implemented sorting
> classes to solve this problem -- but, I don't see any code.
>
> Ideally, I would like to see something like what Sawyer claims or markup
> something like the following:
>
> <logic:iterate id="element" name="myhashtable"
sortby="value1,value2,value3"
> sortorder="ascending">
> Next element is <bean:write name="element" property="value1"/>
> Next element is <bean:write name="element" property="value2"/>
> Next element is <bean:write name="element" property="value3"/>
> </logic:iterate>
>
> Here, "myhashtable" would be sorted in ascending order based on comparable
> "value1", "value2", "value3" of each "element".
>
> If there's nothing within Struts that solves this problem then I would
like
> to work on extending the "iterate" tag to handle this.  Please let me know
> what you think.
>
> Thanks,
>
> --Michael T. Marrotte
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>



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

Reply via email to