【发布时间】:2012-06-08 07:36:03
【问题描述】:
我正在使用 jsp 开发网络应用程序。
我想要做的是,如果变量不为空,我会显示它,但如果为空,我会在表格行中显示- 字符。
这是我目前的代码,我从here学到的
<table id="hor-minimalist-a" summary="Employee Pay Sheet">
<caption>Riwayat Status</caption>
<thead>
<tr>
<th scope="col">Status</th>
<th scope="col">Tanggal</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tanggal DP</td>
<c:choose>
<c:when test="${Transaction.tglDP}">
<td>${Transaction.tglDP}</td>
</c:when>
<c:otherwise}>
<td>-</td>
</c:otherwise>
</c:choose>
</tr>
</tbody>
</table>
但是当我运行网站时,当该变量不为空时,它也会显示值和字符。
我在这里缺少什么?
编辑:有关信息,Transaction.tglDP 类型是 java.util.Date
【问题讨论】:
标签: jsp if-statement html-table