0
我正在使用<tr th:each>
填充表,如果值爲null,我希望將if語句計算爲空值想要把這個「 - 」而不是「null」。如何在填充表的循環內的thymeleaf中執行if
我如何使用th:if
或其他類似的功能來做到這一點,我是新的使用百里香?
這是我的代碼:
<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>
編輯:代碼被編輯及其工作
感謝我編輯我的代碼與您的建議,它的工作 – stackUser2000 2014-09-26 15:16:28
很高興聽到它! – geoand 2014-09-26 16:07:19