Hi, thanks Bosun.I got the solution,but now i have another problem,i want to save a employee's records in thst file.but here when i add second record first one is getting deleted and the new one is replaced. can anyone help me in code..so that i can save the records and append to the same file here ie the code public class kal1 extends HttpServlet {
bf.close(); in.close(); // Respond to client with a thank you toClient.println("<html>"); toClient.println("<title>Thank you!</title>"); toClient.println("<body bgcolor=#ffffff><font face=\"Helvetica\">" + "Thank you for participating</font>");
try { BufferedReader inn = new BufferedReader( new FileReader("myfile")); String str; while ((str = inn.readLine()) != null) { toClient.println(str); toClient.println("<br>"); } inn.close(); } catch (IOException e) { } toClient.println("</body>");
toClient.println("</html>");
} catch(IOException e) { e.printStackTrace(); toClient.println("A problem occured while recording your answers. " + "Please try again."); }
} }
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
posted
0
Hi, I think you should take a look at RandomAccesFile class, than you�ll be able to append your files.
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.