• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

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.
0
jmarkfoley
Asked:
jmarkfoley
1 Solution
 
objectsCommented:
you could create a 2d array

String[][] states = new String[][] { {"AL", "Alabama"}, "{"XX", "Mars"}};

0
 
jmarkfoleyAuthor Commented:
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.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now