my dog learned polymorphism
The moose likes Java in General and the fly likes Store and Read key/value pairs Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Store and Read key/value pairs" Watch "Store and Read key/value pairs" New topic
Author

Store and Read key/value pairs

Paul Woods
Greenhorn

Joined: Nov 15, 2002
Posts: 23
I have a need to store some user selectable options for a struts app, but am waffling as to the best way to store those. Are there any portable / acceptable ways to store key value pairs somewhere in the application, a key interest here being that the mechanism I use has to be writable. I can add and use a table for this in a database, but it seems a bit overkill.
Thanks, Paul
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4118
    
    2

Not really a Struts question. Moving to Java in General (Intermediate).


Junilu - [How to Ask Questions] [How to Answer Questions] [MiH]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12271
    
    1
For key/value pairs that are Strings, look at the Properties class in the java.util package. It is designed for exactly this purpose.
Bill


Java Resources at www.wbrogden.com
Paul Woods
Greenhorn

Joined: Nov 15, 2002
Posts: 23
Thanks, that looks interesting, and I'll look into it further. My primary concern with something this generic though, and perhaps there isn't a good answer, is being allowed to write to the file system when run under a servlet container (ie. Tomcat 4.x).
Thanks again, Paul
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Store and Read key/value pairs
 
Similar Threads
ArrayList.get:ting an integer
printing and returning arrays
when to use ArrayList and when to use HashMap
Hash tables
Hashset, Hashtable and Hashmap