struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Mitchell" <>
Subject Re: Displaying a HashMap as a <select>
Date Tue, 08 Mar 2005 02:17:41 GMT
Sorry for the late response.

I wouldn't use a Map, I would go with a List.  Primarily for ordering. 
There's nothing more strange than hitting a web site and seeing the order of 
some select box changing randomly with each refresh.  I suppose you could 
get away with one of those funkified Map impls over in commons that will 
maintain order.

Just my $0.02

James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
AIM: jmitchtx

----- Original Message ----- 
From: "David Johnson" <>
To: "Struts Users Mailing List" <>
Sent: Monday, 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 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.
> help!
> Also, keep in mind if the way I have the data stored (in a HashMap
> called "codes on the application context) wont work, is there a better
> way to do it?
> -- 
> -Dave
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message