Reputation: 11709
I am using JSTL in my jsp page to iterate my object and then show in the table as shown below and it works fine -
<c:forEach items="${test.dataList}" var="m3">
<tr>
<th>${m3.hostName}</th>
<td>${m3.totalCall}</td>
<td>${m3.timeoutCount}</td>
</tr>
</c:forEach>
Now what I am looking to do is, I want to add percentage of timeoutCount
as compare to totalCall
next to ${m3.timeoutCount}
using JSTL. Below is an example -
MachineA
10000
25 (0.25%)
But if totalCall
is 0 then I don't want to show percentage ratio at all. Is this possible to do in JSP page using JSTL or jquery?
Upvotes: 0
Views: 515
Reputation: 512
try this one:
<c:forEach items="${test.dataList}" var="m3">
<tr>
<th>${m3.hostName}</th>
<td>${m3.totalCall}</td>
<td>${m3.timeoutCount}
<c:if test="${m3.totalCall > 0}">
<c:out value="%"/>
</c:if>
</td>
</tr>
</c:forEach>
I haven't tested it but that should do.
Upvotes: 3