dcsimg
Doesn't Sort data in Ascending way in Hash Table?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   paresh_shah
Posted On:   Wednesday, March 8, 2006 05:36 AM

Hello



I am using JSP, Servlets. After quering in servlets, putting data in HashTable then set attribute in servlets, get attribute in JSP & retrieving data from HashTable in JSP & putting in select html element, data is not coming in ascending order in select drop down box. I need A,B,C,D but it is coming b,d,c,a. When I run query in DB, it shows in sequence but after putting in HashTable, it is not coming in sequence.



How to make it ascending?



Looking forward for an early reply.



Thanks.

Re: Doesn't Sort data in Ascending way in Hash Table?

Posted By:   ankush_purwar  
Posted On:   Wednesday, March 8, 2006 01:58 PM

HashMap and Hashtable doesn't give you any guarantee about the order. they can be in any order irrespective the order in which you have stored it.

Try java.util.TreeMap if you want natural ordering.
About | Sitemap | Contact