tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin van den Bemt" <m...@mvdb.com>
Subject RE: Servlets and relative paths
Date Wed, 30 May 2001 21:26:01 GMT
Just use a config file to point to the files / directories you want to load.
You can put the file location of the config file in the web.xml.

Mvgr,
Martin


> -----Original Message-----
> From: Ronald G. Louzon [mailto:RGLouzon@aethersystems.com]
> Sent: Wednesday, May 30, 2001 2:41 PM
> To: 'tomcat-user@jakarta.apache.org'
> Subject: RE: Servlets and relative paths
>
>
> I found this in the archives (http://marc.theaimsgroup.com ).  You might
> search them for more info if this doesn't work.  If you put the
> file in your
> servlet's classpath, this code, which in this case is accessing a
> properties
> file, should allow you to access the file.
>
> -----------------
>
> InputStream is = this.getClass().getResourceAsStream("myapp.properties");
> Properties p = new Properties();
> try
>

>    p.load(is);
> }
> catch ( java.io.IOException e )
>

> // Can't load props file
>
> -----Original Message-----
> From: Chris McNeilly [mailto:cmcneilly@smartbrief.com]
> Sent: Tuesday, May 29, 2001 11:32 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Servlets and relative paths
>
>
> I've got a servlet and am trying to open files.  The problem is that its
> defaulting to the tomcat/bin directory whenever I attempt to refer to
> them.  How can I change this?  Hardcoding the path isn't such a good
> idea as my dev environment is different from production.  These are xml
> and xsl files and they are located on the webroot.
>
> Thanks,
>
> Chris
>


Mime
View raw message