Write in a file on server with jsp

M

marga

Hello,
I am developing a simple jsp page, and I would like to write in a
test.txt File on server (on which I publish the page) and test.txt is
writable for all.
I don't know the absolute path where my web application resides.
I don't found nothing with Google.

Thanks,
Paolo
 
A

Arne Vajhøj

marga said:
I am developing a simple jsp page, and I would like to write in a
test.txt File on server (on which I publish the page) and test.txt is
writable for all.
I don't know the absolute path where my web application resides.

application.getRealPath("/foobar.txt") will give you the real
path to http://yourserver/yourwebapp/foobar.txt !

I don't think this is a good solution.

You may not have write permission.

And it will not be multi user safe.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top