Click to See Complete Forum and Search --> : Image available or not


rbollen
05-02-2003, 07:26 AM
Hi folks,

I'm working on a website. I get images from a database, but when there is no image available for that record, i wanna display a default error image.

So i have to check if the file exists, i do that with File.isFile()
but then i have to give the full path...

Can anyone help me??

here is the code:

String fotoString = "images\\shopping-cart-image.gif";
File foto = new File(fotoString);
System.out.println(foto.isFile());
if (! foto.isFile()){
fotoString = "images\\photo-not-available.gif";
}

Thanx

khalidali63
05-02-2003, 07:49 AM
I am sorry,I can you explain whats your question ?...

rbollen
05-02-2003, 08:54 AM
which statement must i use to check if image at web-inf/resources/images/shopping-cart-image.gif exists or not??

it only works with the full path (c:\....)

Sorry 4 not being clear