When the temp...">

Absolute path

I have this image in the header template. <img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />

When the template is used from the gsp file inside the "main" directory, the image is loaded. Although, if I have the same template that is used inside the gsp file inside the controller, the image does not load. I tried to change this:

<img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />

:

<img src="../images/slide-1.jpg" alt="Slide #1" width="175" height="77" />

and it works, but now the image on the other page does not. Any idea to solve the problem? I know that the key must be an absolute path. But I did some searching and found nothing.

+3
source share
2 answers

You can put your images in the resource folder (for example, in YOUR_PROJECT/web-app/images), then access it in the gsp resource tag . This way you will not have a problem with the absolute path.

.

+6

"$ {application.contextPath}/images/slide-1.jpg". , .

+2

All Articles