頁面中可能說出現在forEach循環中間需要出力分隔符的問題,
比如:
小明 1年級,小王 2年級, 小張 3年級(循環單位是 ${bean.name} ${bean.class})
此時的逗號出力,我采用下面方法實現完成。
<c:forEach var="bean" items="students">
<c:if test="printCommaFlag">,</c:if>
${bean.name} ${bean.class}
<c:set var="printCommaFlag" value="true" scope="request"/>
</c:forEach>