0
画像が存在する場合のみ画像を表示する次の画像コードを使用しています。Thymeleafは存在しなければ別の画像を表示します
<img th:if="${!ad.adPhotos.empty}" th:src="|/imageDisplay?id=${ad.adPhotos[0].id}|" alt="" class="img-respocive" />
私は、これはThymeleafで行われるだろうか
<img height="150" width="150" src="img/NoPicAvailable.png" />
caluse他のためにこれを表示したいですか?
「
」だけではないのはなぜですか?あるいは 'th:switch'を使ってもいいですか? –
bphilipnyc
https://stackoverflow.com/questions/13494078/how-to-do-if-el---thymeleaf – bphilipnyc
@bphilipnyc「th:if = "$ {ad.adPhotos.empty}」「 – Arya