Solved

Howto create array of String "structures" in jsp?

Posted on 2009-04-07
3
424 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
why cannot we forward request once the response is committed 2 46
login jsp example 24 62
Desingning Refactoring existing code 2 26
login form jsp example 2 35
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

789 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