It's not a secret anymore!
The moose likes JSP and the fly likes filereader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "filereader" Watch "filereader" New topic


Ad Rajesh

Joined: Apr 25, 2006
Posts: 21
i need to save the content in the textarea to a file.
And again i want to read the content from the file.

It is working fine locally,when i upload the program to the server it is not working. could any one give me some suggestion.

[BPSouther: Added UBB code tags]
[ October 31, 2006: Message edited by: Ben Souther ]

SCJP 1.4
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

Check the file path or file is there on path or not ?

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Ad Rajesh

Joined: Apr 25, 2006
Posts: 21
yes, i have cheked the file path... It is correct..still it is not working.

i have the placed the above code in jsp file and i am calling this jsp file in the html page.

If i type some content directly in the jsp, those things are reflected in the server..i,e i can get the content in the html page... if i insert the above code... it is not working.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Ad Rajesh:
.. it is not working.

That doesn't give us much to work with.
What is it doing?
Are you seeing an error message in the browser?
Have you checked the server's logs to see if there is an exception being thrown? If so, what is it?

Java will try to write your file to the current working directory if you don't specify a full path.

The current working directory, in the case of a webserver, is the directory where the user who started the container was when the container was started; not the directory where your JSP lives.
You, the application developer, have no guarantee as to where that directory is going to be AND, even if you do know where it is, will probably not have read/write permissions to it.

You should figure out exactly where you want to write these files, make sure you have sufficent permissions to do so, and then use an absolute path and filename when attempting to read and write your files.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: filereader
It's not a secret anymore!