Skip to content Skip to sidebar Skip to footer

Path To Fetch An Image In Another Dir

I have my images in '/src/main/webapp/images' folder and my html code is in '/src/main/webapp/app/report' folder. How to specify the path to the image mentioned in that other direc

Solution 1:

Generally, you should be able to specify a Relative Path, using /../ to traverse up each directory level:

"../../images/image01.png"

Solution 2:

Below are the relative path rules that you should know :

"/" returns to the root directory and starts path there

"../" moves one directory back and starts path there

"../../" moves two directories backward and starts path there (and so on...)

You need to go two level up to include the image in images folder as below :

<imgsrc="../../images/pdf-file_128.png">

Solution 3:

From your current directory, this should be the path to your image

../../images/your image name.png

Post a Comment for "Path To Fetch An Image In Another Dir"