It's not a secret anymore!
The moose likes Spring and the fly likes unble to write the data into file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "unble to write the data into file" Watch "unble to write the data into file" New topic

unble to write the data into file

Narsi Ranch

Joined: Dec 29, 2010
Posts: 4
Hi ,

i am developing one sample spring web application that is for write the data into test.dat file when i click Register Button.

I wrote the below code for that. But the problem is , data is not writing into file . I thought , that is some configuration problem.

I placed that file in classes folder and WEB-INF folder. So please help me to resolve that problem.

In handle method of RegisterController class::

File file = new File("/test.dat");
try {
fos = new FileOutputStream(file);
FileWriter fw = new FileWriter(file);
} catch (FileNotFoundException e) {
catch(IOException e){
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

And what is the exception that you get?

Also, based on the Servlet Spec, I don't believe you can write to a file in the WEB-INF directory. I am not positive though.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: unble to write the data into file
It's not a secret anymore!