thymeleaf 字符串判断是否存在

时间:2019-11-18 15:04:35   收藏:0   阅读:1547
 <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

原文:https://www.cnblogs.com/liouzeshuen/p/11881799.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!