【发布时间】:2014-11-21 14:55:20
【问题描述】:
我正在使用<tr th:each> 填充一个表,并且我想放置一个 if 语句来评估该值是否为 null,如果值为 null 我想放置此“--”而不是“null” .
我如何使用 th:if 或其他类似的功能来做到这一点,我是新使用 thymeleaf 的?
这是我的代码:
<table id="datatable_fixed_column" class="table table-striped table-bordered" width="100%">
<thead>
<tr>
<th>name</th>
<th>lastname</th>
<tr>
<tbody>
<tr th:each="nodeInfo : ${listOfData}">
<td th:if="${nodeInfo.name} == 'null'"> -- </td>
<td th:if="${nodeInfo.name} != 'null'" th:text="${nodeInfo.name}"></td>
EDITED:代码已被编辑并可以正常工作
【问题讨论】:
标签: html spring-mvc html-table thymeleaf