You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by An...@fiducia.de on 2006/10/02 12:56:34 UTC

Iterating over Hashtable in jsp - wrong sort order

Hello!

I've got a Hashtable

Hashtable <Integer, ArrayList<SomeObject>> mytable;

The keys of this Hashtables are Integers, which are added in ascending order.


In the jsp, I'm doing the following:

<logic:iterate name="mytable" id="element"><bean:write name="element"
property="key"/></logic:iterate>

The keys are now listed in descending order - but I need ascending order. How
can I change this behaviour?


Thanks for any hint,
kind regards,
Andreas Hartmann


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


Re: Iterating over Hashtable in jsp - wrong sort order

Posted by An...@fiducia.de.
Hello Antonio,

thanks for your hint!


Kind regards,
Andreas Hartmann


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


Re: Calling an action from the view (from JSP)

Posted by Antonio Petrelli <ap...@apache.org>.
Andreas.Hartmann@fiducia.de ha scritto:
> Hello!
>
> I've got a Hashtable
>
> Hashtable <Integer, ArrayList<SomeObject>> mytable;
>   


Hashtable does not guarantee anything about order!

> The keys are now listed in descending order

Really? I think it's a lucky behaviour!

>  - but I need ascending order. How
> can I change this behaviour?
>   

Use LinkedHashmap

Ciao
Antonio

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