我正在eclipse中创建一个项目,希望在表格中显示输入到表单中的值。我希望表只显示有值的行,但不知道如何做到这一点。到目前为止,我刚刚添加了多个行,并且为了不显示它们而使用了display:none
,但是我想不出一种让th:text="${name1}"
显示的方法。
下面是我到目前为止使用的方法的一个例子:
<table id="table">
<tr id="tableRow">
<th class="tableHeader">Name</th>
<th class="tableHeader">Description</th>
</tr>
<tr id="tableRow" style="display:none">
<td class="tableCell" th:text="${name1}"></td>
<td class="tableCell" th:text="${description1}"></td>
</tr>
<tr id="tableRow" style="display:none">
<td class="tableCell" th:text="${name2}"></td>
<td class="tableCell" th:text="${description2}"></td>
</tr>
<tr id="tableRow" style="display:none">
<td class="tableCell" th:text="${name3}"></td>
<td class="tableCell" th:text="${description3}"></td>
</tr>
</table>
我对编码比较陌生,因此任何帮助都将不胜感激。
https://stackoverflow.com/questions/47672964
复制相似问题