Write in a file on server with jsp

Discussion in 'Java' started by marga, Mar 2, 2008.

  1. marga

    marga Guest

    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
    marga, Mar 2, 2008
    #1
    1. Advertising

  2. marga

    Arne Vajhøj Guest

    marga wrote:
    > 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
    Arne Vajhøj, Mar 3, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lukasz Indyk
    Replies:
    1
    Views:
    1,456
    Andrew Thompson
    Sep 22, 2004
  2. ramakrishna
    Replies:
    0
    Views:
    1,227
    ramakrishna
    May 4, 2006
  3. Replies:
    0
    Views:
    4,336
  4. Replies:
    2
    Views:
    500
  5. LB
    Replies:
    2
    Views:
    992
    Arne Vajhøj
    Aug 13, 2008
Loading...

Share This Page