You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anton Pussep <an...@pussep.de> on 2007/06/10 22:46:11 UTC

sort entries by the selected tag

Hello,

I would like to sort the menu created by the selected tag. So far I just
pass a TreeMap where the entries are sorted already. However, I think
that the View should decide whether to sort or not to sort, but I could
not find a way to force the selected tag to sort. Is there anything you
can recommend?

<s:form action="DeleteUser">
    <s:select
        list="idToNameMapping"
        name="userId"
        emptyOption="false" />
    <s:submit />
</s:form>

Thanks and best regards,
Anton


[OT] Re: sort entries by the selected tag

Posted by Dave Newton <ne...@yahoo.com>.
--- Anton Pussep <an...@pussep.de> wrote:
> It [could be a map] that just guarantees that its 
> elements keep the order in that they have been
added.

LinkedHashMap.

d.



       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=list&sid=396545433

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: sort entries by the selected tag

Posted by Anton Pussep <an...@pussep.de>.
I think you're right, the View should not be responsible for sorting.
But now I would like to sort by values and I could not find any Map that
is capable of doing so. Do you have any suggestion? Or probably you had
to solve this problem already, then I would love to hear how you did it.

It does not necessarily have to be a sorting map, it could be also one
that just guarantees that its elements keep the order in that they have
been added.

Best,
Anton

Al Sutton wrote:
> I've always put sorting as part of the action by determining the sort order
> creating an appropriate Comparator implementation and using it in the
> constructor for the TreeMap.
> 
> I've done this because imho your view should just be about presentation, and
> the logic for determining and implementing your sort should be in your
> action.
> 
> -----Original Message-----
> From: Anton Pussep [mailto:anton@pussep.de] 
> Sent: 10 June 2007 21:46
> To: Struts Users Mailing List
> Subject: sort entries by the selected tag
> 
> Hello,
> 
> I would like to sort the menu created by the selected tag. So far I just
> pass a TreeMap where the entries are sorted already. However, I think that
> the View should decide whether to sort or not to sort, but I could not find
> a way to force the selected tag to sort. Is there anything you can
> recommend?
> 
> <s:form action="DeleteUser">
>     <s:select
>         list="idToNameMapping"
>         name="userId"
>         emptyOption="false" />
>     <s:submit />
> </s:form>
> 
> Thanks and best regards,
> Anton
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


RE: sort entries by the selected tag

Posted by Al Sutton <al...@al-and-andrea.org.uk>.
I've always put sorting as part of the action by determining the sort order
creating an appropriate Comparator implementation and using it in the
constructor for the TreeMap.

I've done this because imho your view should just be about presentation, and
the logic for determining and implementing your sort should be in your
action.

-----Original Message-----
From: Anton Pussep [mailto:anton@pussep.de] 
Sent: 10 June 2007 21:46
To: Struts Users Mailing List
Subject: sort entries by the selected tag

Hello,

I would like to sort the menu created by the selected tag. So far I just
pass a TreeMap where the entries are sorted already. However, I think that
the View should decide whether to sort or not to sort, but I could not find
a way to force the selected tag to sort. Is there anything you can
recommend?

<s:form action="DeleteUser">
    <s:select
        list="idToNameMapping"
        name="userId"
        emptyOption="false" />
    <s:submit />
</s:form>

Thanks and best regards,
Anton



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org