Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

filereader

 
Ad Rajesh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the file path or file is there on path or not ?
 
Ad Rajesh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic