javascript - jsp formatting with a left over comma -
javascript - jsp formatting with a left over comma -
good afternoon, trying display list of items in table column separated ","
the current formatting have comma displayed after credit card, there comma left on after lastly card, if there no eft payment. i've attached screenshot of problem..
here code:
<%if (creditcards.size() > 0) {%> <% (creditcardpaymentvo card : creditcards) {%> <%= card.gettype()%> , <%}%> <%}%> <% if (eft != null) {%> <%= "eft"%> <%} %>
any thought how can create comma not appear after lastly credit card? time , effort!
scriptlets aren't cool anymore. seek jstl:
<c:foreach var="creditcard" items="${creditcards}" varstatus="status"> <c:out value="${creditcard.type}"/> <c:if test="${!status.last || eft}">, </c:if> </c:foreach> <c:if test="${eft}">eft</c:if>
example based on jstl foreach separator.
javascript list jsp
Comments
Post a Comment