Relative paths in my webapp

2007-09-17 Thread Diego Ezquerro
Hi to everyone.

I'm developing a webapp and need to store some files and use some images stored 
in my project dir but, I have a problem with the relative paths on my app.

If I write a file in using:

File f = new File(someFileName);
f.createNewFile();
FileOutputStream fos=new FileOutputStream(f);
fos.write(fileData,0,fileSize);
fos.flush();
fos.close();
 
it's stored in netbeans-5.5.1/enterprise3/apache-tomcat-5.5.17/bin instead of 
my project root directory.

And if I try to use an image with:

img src=../images/collapsedMidNode.gif border=0/

then the file isn't found, and I must use absolute paths in both cases.

How can i solve this??
Isn't the root directory of the project the one who contains WEB-INF and 
META-INF directories?

Thanks so much for the answers.



Diego Ezquerro Bailac
Asturias, Spain



__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

Re: Relative paths in my webapp

2007-09-17 Thread andrea

hi, Diego

you have to put the images under the webRoot/images  folder...

Andrea

- Original Message - 
From: Diego Ezquerro [EMAIL PROTECTED]

To: struts user@struts.apache.org
Sent: Monday, September 17, 2007 4:33 PM
Subject: Relative paths in my webapp


Hi to everyone.

I'm developing a webapp and need to store some files and use some images 
stored in my project dir but, I have a problem with the relative paths on my 
app.


If I write a file in using:

   File f = new File(someFileName);
   f.createNewFile();
   FileOutputStream fos=new FileOutputStream(f);
   fos.write(fileData,0,fileSize);
   fos.flush();
   fos.close();

it's stored in netbeans-5.5.1/enterprise3/apache-tomcat-5.5.17/bin instead 
of my project root directory.


And if I try to use an image with:

   img src=../images/collapsedMidNode.gif border=0/

then the file isn't found, and I must use absolute paths in both cases.

How can i solve this??
Isn't the root directory of the project the one who contains WEB-INF and 
META-INF directories?


Thanks so much for the answers.



Diego Ezquerro Bailac
Asturias, Spain



__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/ 



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