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 Mike Lewis 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 file using jsp 1

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
I'm trying to use the following snippet to write some data to a text file.

String nameOfTextFile = "try {
java.io.FileWriter fw = new java.io.FileWriter(nameOfTextFile);
fw.write(str);
fw.close();


but I keep getting a "no such file or directory" error.
Does anyone have any idea why?

Thanks for any thoughts.
 
Keep in mind that jsp runs at server side.

Appart from that, you cannot write a file via http. The name of the file should be something like "/root_dir/whatever_dir/myFile.xml" as it was referenced from command line.

Cheers,
Dian
 
Thanks.....that's what I figured. I will have to see if I can find the file on file system.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top