Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Spring
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Spring
unble to write the data into file
Narsi Ranch
Greenhorn
Posts: 4
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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");
System.out.println(file.getPath());
try {
fos = new FileOutputStream(file);
FileWriter fw = new FileWriter(file);
fw.write("hello");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
catch(IOException e){
e.printStackTrace();
}
Mark Spritzler
ranger
Posts: 17347
11
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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.
Mark
Perfect World Programming, LLC
-
iOS Apps
How to Ask Questions the Smart Way FAQ
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Writing to a File
No unsigned data
Writing to a file from an EJB
PrintWriter writing not more than 1050000 lines
Reg PrintWriter
More...