I need the image to be loaded into the html img tag using thymeleaf. The problem is that the image itself is derived from a url that takes two parameters.
Example:
<img src="/products/images?categoryId=1&image=1" />
The problem is that the image parameter is generated dynamically and therefore I need to use the tyymeleaf expression there. So I tried something like this:
<img th:src="@{'/products/images?categoryId=1&image=' + ${product.id}}" />
But when I run this, I get the following message:
Exception parsing document: template="product-list", line 104 - column 59
Which indicates the place where the '&' character is. Now I tried to use '& amp; "but then the url becomes something like
/products/images?categoryId=1&image=1
Obviously this will not work.
So how can I make the correct link with two parameters using thymeleaf, then?
source share