thymeleaf 字符串判斷是否存在


 <img th:if="${#strings.containsIgnoreCase(files.fileName,'xls')}"
      class="image img-rounded" th:height="200" th:width="200"
      th:src="@{/xls.jpg}">
<img th:if="${#strings.containsIgnoreCase(files.fileName,'pdf')}"
     class="image img-rounded" th:height="200" th:width="200"
     th:src="@{/pdf.jpg}">
<img th:if="${#strings.containsIgnoreCase(files.fileName,'doc')}"
     class="image img-rounded" th:height="200" th:width="200"
     th:src="@{/doc.jpg}">
<img th:if="${!#strings.containsIgnoreCase(files.fileName,'doc')&&!#strings.containsIgnoreCase(files.fileName,'xls')&&!#strings.containsIgnoreCase(files.fileName,'pdf')}"
     class="image img-rounded" th:height="200" th:width="200"
     th:src="@{/kbm/avatar/2019-09-25/9df6747293bd2a44f6d087a99a107f87.png}">

參考:https://blog.csdn.net/qq_33535433/article/details/78876693


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM