Troncador Troncador - 2 years ago 202
HTML Question

How can I configure in Thymeleaf the base URL?

I use Thymeleaf for the templates of a web application.

When I make a link I use a URL like this:

<img class="info"
th:src="@{/resources/img/image.png}" />

How can I configure the base URL in Thymeleaf?

I need this because my application runs in the current URL:


And it works fine, but then it redirects to:

Then the images was search in:

instead of:

I want something like:

<property name="baseURL" value=""/>

Answer Source

Try Server-relative URLs:

<img class="info" th:src="@{~/resources/img/image.png}" />

Actual link to url part of Thymeleaf 2.1. tutorial

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download