You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dennis Muhlestein <de...@zserve.com> on 2002/10/30 18:40:50 UTC

html:options ordering

I have a hashtable with key/value that get displayed by an html:options
tag.  

Works ok, but they are ordered in reverse order of the id.  That isn't
any performance problem, but it looks a little strange to the user.

For instance, what if you wanted the options in alphabetical order?  In
my case, I need them ordered by the key for each options.

Any Suggestions?
TIA
-Dennis


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: html:options ordering

Posted by Sven Bischoff <sv...@web.de>.
> Dennis Muhlestein wrote:
> 
>> I have a hashtable with key/value that get displayed by an html:options
>> tag. 
>> Works ok, but they are ordered in reverse order of the id.  That isn't
>> any performance problem, but it looks a little strange to the user.
>>
>> For instance, what if you wanted the options in alphabetical order?  In
>> my case, I need them ordered by the key for each options.


if you're using jdk1.4, try java.util.LinkedHashMap which preserves 
insertion-order.


>> -Dennis

Sven


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: html:options ordering

Posted by Danny Mui <da...@muibros.com>.
Hash Tables don't guarantee order when you pull them out enmasse. 
 probably best bet is to store it in a list and sort accordingly 
(Collections.sort).


Dennis Muhlestein wrote:

>I have a hashtable with key/value that get displayed by an html:options
>tag.  
>
>Works ok, but they are ordered in reverse order of the id.  That isn't
>any performance problem, but it looks a little strange to the user.
>
>For instance, what if you wanted the options in alphabetical order?  In
>my case, I need them ordered by the key for each options.
>
>Any Suggestions?
>TIA
>-Dennis
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>  
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: html:options ordering

Posted by Dennis Muhlestein <de...@zserve.com>.
Thanks for the comments.  Seems to make more sense not to have 
any ordering functionality in the html:options tag anyway.

On Wed, 2002-10-30 at 10:40, Dennis Muhlestein wrote:
> I have a hashtable with key/value that get displayed by an html:options
> tag.  
> 
> Works ok, but they are ordered in reverse order of the id.  That isn't
> any performance problem, but it looks a little strange to the user.
> 
> For instance, what if you wanted the options in alphabetical order?  In
> my case, I need them ordered by the key for each options.
> 
> Any Suggestions?
> TIA
> -Dennis
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>