Solved

Howto create array of String "structures" in jsp?

Posted on 2009-04-07
3
423 Views
Last Modified: 2012-05-06
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
Comment
Question by:jmarkfoley
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 24092535
you could create a 2d array

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

0
 
LVL 12

Expert Comment

by:basav_com
ID: 24092880
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 24092931
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 86
How can I   ajax html table  rows? 20 76
object oriented programming comparison 5 72
javap not working 8 46
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question