Not the best code, but I guess this is close to what you're looking for: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ index.jsp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head><title></title></head> <body> <jsp:useBean id="writeFile" class="test27.WriteFile"/> <jsp:setProperty name="writeFile" property="fileText" value="Some Text"/> The file was written : <jsp:getProperty name="writeFile" property="writeToFile"/> </body> </html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WriteFile.java ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ package test27; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class WriteFile { String fileText; boolean writeToFile; public WriteFile() { } public String getFileText() { return fileText; } public void setFileText(String fileText) { this.fileText = fileText; } public boolean getWriteToFile() { try { BufferedWriter out = new BufferedWriter(new FileWriter("C://test.txt")); out.write(this.fileText); out.close(); writeToFile = true; } catch (IOException e) { writeToFile = false; //Log the exception here e.printStackTrace(); } return writeToFile; } public void setWriteToFile(boolean writeToFile) { this.writeToFile = writeToFile; } } -Rashmi ----- Original Message ---- From: Teh Noranis Mohd Aris <[EMAIL PROTECTED]> To: users@tomcat.apache.org Sent: Saturday, February 10, 2007 11:35:27 PM Subject: Servlet/JSP source code to save data in a file Dear all, Does anyone have the Servlet/JSP source code to save data in a file that will be located in the server? I need the source code very urgently. I have my own version but it is not working. Please help me! Thank you. Yours Sincerely, TEH NORANIS --------------------------------- Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. ____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]