on 06-27-2011 7:24 AM
Hello All,
I have a property file named "Filesystem.properties". entried as follows in it.
Drives = C;D
C = Documents;Program_Files;Temp;Windows;start.bat
I am rendering this structure in a tree UI. I am using the std. Tut_WD_tree component available on SDN. In additon to this, i have a requirement to change the values in properties file if a user selects any value in the tree.
Actually, I have to implement drag & drop functionality and it is possible in CE 7.2 but what I am not getting is how to retrieve the values in this property file and edit it using a java code.
I also referred to this thread but code given at this thread wont work in my case.
Any help or pointers for this?
Ameya
Hi,
Below is the snippet to write data into the existing property file,
Properties properties = new Properties();
File propFile = new File("FilePath for propetry file");
FileInputStream ipStream = null;
FileOutputStream opStream = null;
if(propFile.exists()){
try {
ipStream = new FileInputStream(propFile);
properties.load(ipStream);
properties.put("New Key/Old Key", "New Value");
opStream = new FileOutputStream(propFile);
properties.store(opStream, null);
wdComponentAPI.getMessageManager().reportSuccess("File updated Successfully");
}
catch (Exception e) {
wdComponentAPI.getMessageManager().reportException(e.toString());
}
finally{
if(null != ipStream ){
ipStream.close();
}
}
}
else{
wdComponentAPI.getMessageManager().reportException("File not Found");
}
Regards,
Vishweshwara P.K.M.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.