thymeleaf th:value 多个值拼接 使用+号 或者|符号 (不适用于th:field)
生活随笔
收集整理的這篇文章主要介紹了
thymeleaf th:value 多个值拼接 使用+号 或者|符号 (不适用于th:field)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
注意,不能在th:field中使用拼接
?thymeleaf th:value 可以使用+號拼接兩個字符串
<div class="col-sm-9"><label th:each="brand:${brands}" class="check-box"><input id="brands" name="brands" type="checkbox" th:value="${brand.brandId}+','+${brand.brandShortName}" th:text="${brand.brandShortName}"></label> </div>另外 ?可以使用||符號將需要需要拼接的字符串包起來:參考地址
<div class="col-sm-9"><label th:each="brand:${brands}" class="check-box"><input id="brands" name="brands" type="checkbox" th:value="|${brand.brandId},${brand.brandShortName}|" th:text="${brand.brandShortName}"></label> </div>?
總結
以上是生活随笔為你收集整理的thymeleaf th:value 多个值拼接 使用+号 或者|符号 (不适用于th:field)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 内联js th:inline标签
- 下一篇: 合并Firefox的书签