| Author |
Properties file issue
|
Keerthi Chandhu
Greenhorn
Joined: Feb 03, 2009
Posts: 16
|
|
Hi,
I am trying to modify a .properties file in a jsp screen and save the modified content in the properties file.
my file data looks like this
Before modification
Key1=value1
key2 = value2
###comments#####
After modification
ey1=value1 //missing first letter while saving
key2 = null // saving null value due to having space between "=" sign
###comments#####
I am having two issues while saving:
(i) If there is space between "=" sign like Key2 = value2 then it is saving as null value like this key2 = null
(ii) If the charAT(0) is not space or # at the starting line of my property file then it is saving that property missing first letter of the key.
Could anyone suggest how to make this work properly?
Thank you
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
|
Well... how are you doing it now? The Properties class has decent read/write routines of its own; are you using these?
|
[Jess in Action][AskingGoodQuestions]
|
 |
Keerthi Chandhu
Greenhorn
Joined: Feb 03, 2009
Posts: 16
|
|
Hi,
Yes, I am using the following method to write into properties file.Properties props = new Properties();
but as we know we can't retain comments.To save comments I am using some logic
and I am facing the above issues as I mentioned in my previous message.
(i) If there is space between "=" sign like Key2 = value2 then it is saving as null value like this key2 = null
(ii) If the charAT(0) is not space or # at the starting line of my property file then it is saving that property missing first letter of the key.
Could anyone suggest me how to make this work properly?
Thank you
|
 |
 |
|
|
subject: Properties file issue
|
|
|