This is my jsp code for saving back the data to .properties file after editing. i used 2 Linked properties as one LinkedProperties pro is to get the data from the path and the other one to get attribute (eg: id, name, age, gender etc.) from default .properties file so that i don't have to hard code everything in every page:

String path = request.getParameter("path");
	File dir = new File(path);
	FileInputStream in = new FileInputStream(dir);
	LinkedProperties pro = new LinkedProperties();
	Enumeration em = pro.keys();
	//default file
	File d_dir = new File("C:/workspace_indigo/Configuration/WebContent/");
	LinkedProperties d_pro = new LinkedProperties();
	FileInputStream d_in = new FileInputStream(d_dir);
	Enumeration ems = d_pro.keys();
	//save to file.
			if (request.getParameter("id") != null) {
				while (ems.hasMoreElements()){
					String str = (String) ems.nextElement();
					pro.setProperty(str, request.getParameter(str));	
				} FileOutputStream(path), null);%>
			<script type="text/javascript">
				alert("Change Saved sucessfully.");
		<% 	}

I can save the file back into the corresponding .properties file but the problem is i cannot delete the file after editing is save. The error message is the file is still in used.

help me.

Did you ever considered that is not 24/7 coding solution, or that perhaps people do not want to do anything with coders that insist to do stuff directly from JSP or perhaps people do not know or are not interested.
Count me in the group "do not want to touch code with direct JSP manipulation". Word of advice, it is possible, I do use it often when I change CSS settings of my blog that is run on open source project called Pebble. There is your solution, go through code and find you solution there...

This article has been dead for over six months. Start a new discussion instead.