I have a program that's currently designed as follows
UserData.class - contains the following method
Public Hashtable Get_Companies(){[ul][li]selects every company name and company id from Companies table alphabetically by company name [/li][li] Puts resultset into a hashtable. [/li][li] Then returns the hashtable.[/li][/ul]}
AddUser.jsp[ul][li]Calls Get_Companies() [/li][li]Uses a loop to retrieve the company name and company id from the returned hashtable & Puts each company name into a drop down list box that the user can choose from.[/li][/ul]
The issue is that when I loop through the hashtable to display the company names in the drop down list box, it's no longer in alphabetical order. So, I now understand that a hashtable is not what I need because it doesn't hold the order of the elements. But will a Vector work? My goal is to let the user select the company name but to have the company id available in the background. Does anyone have any advice or examples of how I can achieve this? Do I need a hashtable and a vector to work together for my purposes? I'd appreciate any help you may be able to offer.
Thank You,
CrystalVisualBOracle
UserData.class - contains the following method
Public Hashtable Get_Companies(){[ul][li]selects every company name and company id from Companies table alphabetically by company name [/li][li] Puts resultset into a hashtable. [/li][li] Then returns the hashtable.[/li][/ul]}
AddUser.jsp[ul][li]Calls Get_Companies() [/li][li]Uses a loop to retrieve the company name and company id from the returned hashtable & Puts each company name into a drop down list box that the user can choose from.[/li][/ul]
The issue is that when I loop through the hashtable to display the company names in the drop down list box, it's no longer in alphabetical order. So, I now understand that a hashtable is not what I need because it doesn't hold the order of the elements. But will a Vector work? My goal is to let the user select the company name but to have the company id available in the background. Does anyone have any advice or examples of how I can achieve this? Do I need a hashtable and a vector to work together for my purposes? I'd appreciate any help you may be able to offer.
Thank You,
CrystalVisualBOracle