Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write data to a file using servlets.

Status
Not open for further replies.

spankweat

Technical User
Jul 27, 2001
13
US
Hi,

I have a Java Servlet that writes results from a form to a text file.

FileWriter fw = new FileWriter("results", true);
PrintWriter pw = new PrintWriter(fw,true);
pw.print("data");

I ran the servlet on my home computer (using the web server provided by the jsdk) and it saved the file in c:\jsdwk\results.txt

I tried it on my website and I couldnot find the results.txt file. I tried to save it into one of my subdirectory but that didnot work either. I did a System.getProperty("user.dir") and I got "" back.

Do I have to do something special?
THanks!
 
If you don't get any help here then go to ;-) "and everything under the sun is in tune
but the sun is eclipsed by the moon." --Pink Floyd: Eclipse


"I'm going to spend eternity
reinstalling Windows." --Reinstalling Windows: by some British guy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top