ServletContext.getResourceAsStream() is perfect for reading a file. But what
about writing a file ?

Dom


----- Original Message -----
From: "Fernando Padilla" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Jonathan Asbell" <[EMAIL PROTECTED]>
Sent: Tuesday, February 20, 2001 4:34 PM
Subject: Re: *** Referring to a file or a directory from inside a
jsp/servlet or bean ???? ***


>
>
> It all depends on what your code is.  I'm assuming you're just using new
> File( relpath ), which should be relative to the user.dir system property,
> which should be Tomcat bin I suppose ( this is all educated guessing i
> tell you. ).
>
> Does knowing that help you? Your relative path should then be
> "../webapps/myapp/etc".
>
>
> Instead of getting to a file as such, you really should be using some of
> the file/resource accessors from ServletContext, so that it will be
> relative to the context root so that it's portable..  Look at
> ServletContext.getResource() and ServletContext.getResourceAsStream().
>
> fern
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to