Mark
asked on
Howto create array of String "structures" in jsp?
This is probably very elementary, but how would I create an arrary of structures in jsp? Here's the C version of what I want:
typedef struct {
char *abbrev;
char *name;
} STATES ;
STATES states = {"AL","Alabama", ... };
states[0].name // references "Alabama"
I don't want to create any external class files, etc.
typedef struct {
char *abbrev;
char *name;
} STATES ;
STATES states = {"AL","Alabama", ... };
states[0].name // references "Alabama"
I don't want to create any external class files, etc.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
objects - thanks, I used your solution and it was simple. I thought there might be something a bit more elegant than a 2-D array, but I suppose that also means far more complex.
basav_com - thanks for the links, although I didn't see any actual code on the HashMap list, but maybe I didn't look hard enough.
basav_com - thanks for the links, although I didn't see any actual code on the HashMap list, but maybe I didn't look hard enough.
You can use HashMap also:
http://www.roseindia.net/java/java-tips/data/collections/exercises/q-pr-state-capitals-output-2a.shtml
More about arrays:
http://www.1your.com/drupal/represent2ddatainjavausingarrays