well now i want to store all these infomation against an USERID as key for these information in the property file.
the problem is how can i store all these values against USERID as key? because what i presume the value for key would be a single
String message. Not that i can get name , address,or telephone number separately for a same key.
What is going in my mind is that i can store like this in property file
2001 = Rohit,Street number 5 ABCD, 2828282;
and on fetching in servlet..i can break the String whereever i get comma. in this way i will get the required attributes for userBean and then i can create the key value pair for hashmap. but i don't know if this is a correct one method.
My Requirement in application what i wanted in my application was that i would read the property file and fetch information against the USERID as key and create a hashmap where again the key is the USERID and value is userBean object which has the name , address, telephone number defined in the property file against the same USERID.
Is is it posssible in way..or some other way..
if in any way it can be implemented through property file , please suggest me the way.
i know i can store all these things in a database also ..but that is currently avoided and i want it to implement through property file.
The userBean object can be serialized and stored as a file. Maybe you can use the "2001.ser" (the corresponding user id) as the filename. Later when you need the values corresponding to 2001, you can deserialize this file and create the userBean object. That directly gives you the Object to put on the map...
Trying to use Property files for anything more complex than a name/value pair leads to confusion. You should have seen the mess in early JRun servlet engines before XML was adopted for configuration.
XML has many advantages, easy to read, can be written with a text editor, and mainly - its eXtensible. Since it is extensible, I can add new configuration parameters to my servlets without breaking anything.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop