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. Advertisements

  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. Advertisements

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. Phil Powell
    Replies:
    1
    Views:
    562
    Matthew Woodward
    Sep 17, 2003
  2. Lukasz Indyk
    Replies:
    1
    Views:
    1,640
    Andrew Thompson
    Sep 22, 2004
  3. ramakrishna
    Replies:
    0
    Views:
    1,521
    ramakrishna
    May 4, 2006
  4. Replies:
    0
    Views:
    4,938
  5. Replies:
    8
    Views:
    4,778
    Manish Pandit
    Oct 11, 2006
  6. Replies:
    2
    Views:
    712
  7. LB
    Replies:
    0
    Views:
    885
  8. LB
    Replies:
    2
    Views:
    1,188
    Arne Vajhøj
    Aug 13, 2008
Loading...