jstl循环list加逗号

 <c:forEach var="c" items="${v.categories}">


                    <c:if test="${flag}">,</c:if>
                    ${c.name}

                    <c:set var="flag" value="true" scope="request"/>


                </c:forEach>

 

<c:choose>
                <c:when test="${fn:length(productEntities) > 0}">
                    <c:forEach var="p" items="${productEntities}" varStatus="idx">
                        <c:if test="${idx.index == 0}">
                            ${p.productName}
                        </c:if>
                        <c:if test="${idx.index != 0}">
                            ,${p.productName}
                        </c:if>
                    </c:forEach>
                </c:when>
                <c:otherwise>
                     为空
                </c:otherwise>
            </c:choose>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。