You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Donie Kelly <do...@tecnomen.ie> on 2001/11/06 15:20:31 UTC

RE: how to set the path to write files (on the server) from a ser vlet

Have a look at ServletContext.getRealPath(virtualPath)

Might solve your problem....
Donie


 -----Original Message-----
From: 	Elroy, Rebecca [mailto:Rebecca.Elroy@B.Materna.de] 
Sent:	06 November 2001 14:09
To:	'Tomcat Users List'
Subject:	AW: how to set the path to write files (on the server) from
a ser vlet


Why not use an servlet init parameter in your web.xml? Your path is then
specified outside your code and you can easily update it.

Example:
  <servlet>
	<servlet-name>yourservlet</servlet-name>
	<servlet-class>your.Servlet</servlet-class>
	<init-param>
	 <param-name>xml_dir</param-name>
	 <param-value>some/path</param-value>
	</init-param>
  </servlet>

Rebecca

-----Ursprüngliche Nachricht-----
Von: moro.stefano@inwind.it [mailto:moro.stefano@inwind.it]
Gesendet: Dienstag, 6. November 2001 15:05
An: tomcat-user@jakarta.apache.org
Betreff: how to set the path to write files (on the server) from a
servlet



I'm using Tomcat 4.0 and Apache 1.3.22 and I've the following problem:
when my servlet writes an xml file, it goes in a system directory of NT, so
that I've to write the full path "C:\..." to write this file in the right
directory. It's a problem of course because the full path changes if I
change pc, hard disk and so on...
So, how should I set the path to write files in Tomcat ?
Thanks in advance...

                 Stefano Moro


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>