jsp - Using JSTL, if list is empty - display validation message -
i using jstl display values in list
<tbody id="tbna" > <c:foreach items="${actionbean.excesslist.newactivecustomerexcessuilist}" var="customerexcess" varstatus="loop"> <c:set var="clientname" value="${customerexcess.clientname}" scope="page"></c:set> <c:set var="ultimateparent" value="${customerexcess.ultimateparent}" scope="page"></c:set> <c:set var="cif" value="${customerexcess.cif}" scope="page"></c:set> <c:foreach items="${customerexcess.excesslist}" var="excess"> <tr> <td><c:out value="${excess.excessid }"></c:out></td> <td><c:out value="${excess.opendate }"></c:out></td> <td><a href="#" onclick="openclientexcesspage('${cif}');" ><c:out value="${clientname}"></c:out></a></td> <td><c:out value="${ultimateparent}"></c:out></td> <td><c:out value="${excess.excessamount }"></c:out></td> <td><c:out value="${excess.excessda}"></c:out></td> </tr> </c:foreach> </c:foreach>
if list empty, have disply message "no data available".... not sure how this...
you have use choose tag
<tbody id="tbna" > <c:choose> <c:when test="${empty actionbean.excesslist.newactivecustomerexcessuilist}"> <tr><td colspan="6">no data available</td></tr> </c:when> <c:otherwise> <c:foreach items="${actionbean.excesslist.newactivecustomerexcessuilist}" var="customerexcess" varstatus="loop"> <c:set var="clientname" value="${customerexcess.clientname}" scope="page"></c:set> <c:set var="ultimateparent" value="${customerexcess.ultimateparent}" scope="page"></c:set> <c:set var="cif" value="${customerexcess.cif}" scope="page"></c:set> <c:foreach items="${customerexcess.excesslist}" var="excess"> <tr> <td><c:out value="${excess.excessid }"></c:out></td> <td><c:out value="${excess.opendate }"></c:out></td> <td><a href="#" onclick="openclientexcesspage('${cif}');" ><c:out value="${clientname}"></c:out></a></td> <td><c:out value="${ultimateparent}"></c:out></td> <td><c:out value="${excess.excessamount }"></c:out></td> <td><c:out value="${excess.excessda}"></c:out></td> </tr> </c:foreach> </c:foreach> </c:otherwise> </choose>
Comments
Post a Comment