You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Navjot Singh <na...@net4india.net> on 2003/07/08 07:13:14 UTC

RE: Urgent!!!Sorting Problem while loading from HashMap

Rememeber HashMap keys are never guaranteed to be kept in any order. You can
read on java API for more details.

There is other way round. Create two lists, one of labels and one for
values. Save them as memebers under 1 class.
and use <html:optionscollection>. See struts docs for HTML taglib for more
details.

HTH
-navjot



|-----Original Message-----
|From: O_Parthasarathy Kesavaraj [mailto:ParthasarathyK@PLANETASIA.COM]
|Sent: Tuesday, July 08, 2003 10:47 AM
|To: 'Struts Users Mailing List'
|Subject: Urgent!!!Sorting Problem while loading from HashMap
|
|
|Hi
|I am loading a html:select box with property as the key in the HashMap( ID
|corresponding to the value which is displayed) and labelproperty as the
|value.When i am fetching from the database i am sorting by the value and
|then only loading in the HashMap.But when i see the select box the values
|are not sorted..which makes my form not so userfriendly...Kindly help to
|display sorted when i am loading from a HashMap...(When i load using an
|araylist it displays the values in the order i have stored and there is no
|sorting problem)
|
|Thanks in Advance
|Regds
|Partha
|
|---------------------------------------------------------------------
|To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
|For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|


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