Be careful here - getRealPath() can return null when the application is
deployed in a WAR if the app server does not expand it (some app server
do in fact serve the files straight from the WAR).  I got bitten by this
recently.

Instead try looking at the getResource() and getResourceAsStream()
methods.

Kev

> -----Original Message-----
> From: "Moritz Björn-Hendrik, HH" [mailto:[EMAIL PROTECTED]]
> Sent: 22 November 2001 14:42
> To: 'Struts Users Mailing List'
> Subject: AW: OFFT: base for file reading in WEB apps
> 
> 
> Hi Gundars,
> 
> you can get the Base-Path by using the
> getServletContext().getRealPath("")-Method in the ActionServlet.
> 
> Björn
> 
> > -----Ursprüngliche Nachricht-----
> > Von:        Gundars Kulups [SMTP:[EMAIL PROTECTED]]
> > Gesendet am:        Donnerstag, 22. November 2001 15:12
> > An: [EMAIL PROTECTED]
> > Betreff:    OFFT: base for file reading in WEB apps
> > 
> > Hi!
> > I know that this is totally off topic, but what is file 
> base for file 
> > operations for classes running in servlet container (Tomcat 
> in my case). 
> > For example if I have app.properties file in WEB-INF directory, what
> > should 
> > be the path I need to use to open this file?
> > 
> > WBR,
> > 
> > Gundars Kulups
> > Project manager
> > A/S Dati
> > Phone: +371-7067713
> > Mobile: +371-9466055
> > Fax: +371-7619573
> > 
> > 
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

Reply via email to