As a practical matter, I think the best test is always going to be: 

What happens when the suits want this done outside of a Web application?

If sorting is done on the model tier, then it is reusable in a Swing
application, a PDF, a XLST document, a Velocity template, and even an
email. 

In end, whereever you do it is going to require a comparable amount of
work. The question is whether the work is going to be resuable or not. 

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


Michael Marrotte wrote:
> 
> Andrej;
> 
> I've seen this lightly debated, before - that is, whether or not sorting
> should be in the Model or the View.  I haven't been completely persuaded one
> way or the other.  I suppose there's good reason for both arguments.  Does
> sorting create a different "view" of the same data or does sorting "change"
> the data?  There's probably times when looking at it one-way over the other
> is more practical.
> 
> [EMAIL PROTECTED] sent me a link (http://edhill.its.uiowa.edu/display/) to a
> <display:*> tag library that implements sorting which seems very practical,
> e.g. it allows users to sort rows by clicking on column headers.
> 
> Does anyone have a strong argument for either "view"?
> 
> --Michael Marrotte
> 
> -----Original Message-----
> From: Struts Newsgroup [mailto:@[EMAIL PROTECTED]]
> Sent: Tuesday, May 14, 2002 2:40 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Logic:Iterate:sort, what do you think?
> 
> 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]>
> 
> --
> 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