我正在尝试使用jstl处理列表。我想把列表中的第一个元素与其他元素区别开来。也就是说,我只想要第一个元素将显示设置为阻止,其他应该隐藏。JSTL:迭代列表,但不同地对待第一个元素
我现在看起来臃肿,并且不起作用。
感谢您的任何帮助。
<c:forEach items="${learningEntry.samples}" var="sample">
<!-- only the first element in the set is visible: -->
<c:if test="${learningEntry.samples[0] == sample}">
<table class="sampleEntry">
</c:if>
<c:if test="${learningEntry.samples[0] != sample}">
<table class="sampleEntry" style="display:hidden">
</c:if>
根据使用情况,你也可以使用一个语句的时候foreach循环里面'' –
davidcondrey
2015-02-04 18:53:25