Q:

Error using  in table with jsp

I'm developing web app using jsp.
What I want to do is, if a variable is not null, I'll display it, but if null, I'll display - character in table row.
This my code so far, I learned from 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>

But when I run the website, when that variable is not null, it displaying the value and character - too.
What am I missing here? 
Edit : for information, Transaction.tglDP type is java.util.Date

A:

You can use not empty for null check, also you dont have to do multiple when if you want if else block just use otherwise 
<c:choose>
      <c:when test="${not empty  Transaction.tglDP}">
            <td>${Transaction.tglDP}</td>
      </c:when>
      <c:otherwise>
            <td>-</td>
      </c:otherwise>
</c:choose>

