Re: Displaying a HashMap as a select

2005-03-08 Thread Jeff Beal
Even if the results coming out of the database are sorted, throwing them into a non-sorted Collection, like a basic HashMap, will un-sort them. If you use a List, you just preserve the database sort order. If you use a TreeMap, you can get the same sort order, but the TreeMap object will go

RE: Displaying a HashMap as a select

2005-03-08 Thread Nidel, Mike
, March 08, 2005 9:34 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Displaying a HashMap as a select Even if the results coming out of the database are sorted, throwing them into a non-sorted Collection, like a basic HashMap, will un-sort them. If you use a List, you just

Re: Displaying a HashMap as a select

2005-03-08 Thread Jeff Beal
Good point. I had forgotten about that class (added in JDK 1.4). On Tue, 08 Mar 2005 11:18:50 -0500, Nidel, Mike [EMAIL PROTECTED] wrote: Note that there's also the java.util.LinkedHashMap which will maintain whichever order you insert the values in. This gives -- Jeff Beal Webmedx, Inc.

Displaying a HashMap as a select

2005-03-07 Thread David Johnson
Hi all I have a HashMap in my application context called codes that contains a bunch of key,value pairs where the key is an Integer representing the codeID and the value is a string representing the codeName I simply want to create a select box containing all the items in my HashMap (displaying

Re: Displaying a HashMap as a select

2005-03-07 Thread Wendy Smoak
From: David Johnson [EMAIL PROTECTED] I simply want to create a select box containing all the items in my HashMap (displaying the codeName but passing the codeID) What's the easiest way to do this? Can I do this wil just a vanilla HashMap? The examples are slightly confusing. I agree... I can

Re: Displaying a HashMap as a select

2005-03-07 Thread David Johnson
Thanks Wendy! My problem was the following. In order to get this select to display, I of course needed to set up all the crap asociated with doing such a thing... This is a list partially to get it into the archives so I can search on it later. So, I did the following 1. Loaded an ArrayList of

Re: Displaying a HashMap as a select

2005-03-07 Thread James Mitchell
, March 07, 2005 11:33 AM Subject: Displaying a HashMap as a select Hi all I have a HashMap in my application context called codes that contains a bunch of key,value pairs where the key is an Integer representing the codeID and the value is a string representing the codeName I simply want to create

Re: Displaying a HashMap as a select

2005-03-07 Thread Wendy Smoak
From: James Mitchell [EMAIL PROTECTED] I wouldn't use a Map, I would go with a List. Primarily for ordering. I use java.util.TreeMap-- automatic alphabetical order for my lists of (String) codes and descriptions. -- Wendy Smoak