Thymeleaf,如何用th:src做条件语句?

Thymeleaf, how to make conditional statement with th:src?

如果 dish.imageFolder 不为空 - 它应该是

<img th:src="@{${dish.imageFolder}}"/>

如果为 null - 此图片

  <img src="https://via.placeholder.com/150" alt=""/>

一个选项:

<img th:src="${dish.imageFolder != null} ? @{${dish.imageFolder}} : 'https://via.placeholder.com/150'" />

不过我可能只使用 th:if,像这样:

  <img th:if="${dish.imageFolder != null}" th:src="@{${dish.imageFolder}}" />
  <img th:if="${dish.imageFolder == null}" src="https://via.placeholder.com/150" />