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