tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique BATARD" <dbat...@sf2r.fr>
Subject Re: *** Referring to a file or a directory from inside a jsp/servlet or bean ???? ***
Date Tue, 20 Feb 2001 16:23:26 GMT

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

Dom


----- Original Message -----
From: "Fernando Padilla" <fern@interdimensions.com>
To: <tomcat-user@jakarta.apache.org>; "Jonathan Asbell" <jasbell@i-2000.com>
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
>
>
>



Mime
View raw message