我试图确保对象列表不为空,并且至少有一个项目在其中。请告诉我,我在做什么错了下面的代码片段。if/else in jstl
<c:if test=" ${ (not empty educations) && (fn:length(educations) ge 1) }">
<c:forEach items="${educations}" var="edu">
<div class="educations">
<label>Position</label><input type="text" name="${ edu.index }" /><br/>
<label>School</label><input type="text" name="${ edu.school }" /><br/>
<label>Degree</label><input type="text" name="${ edu.degree }" /><br/>
<label>GPA</label><input type="text" name="${ edu.scored }" /><br/>
<label>Start Date</label><input type="text" name="${ edu.startDate }" /><br/>
<label>End Date</label><input type="text" name="${ edu.endDate }" /><br/>
</div>
</c:forEach>
</c:if>
我发现它在if语句通过调试停权,并HMLT标签内还没有被渲染,即使有在的教育列表项
你检查了这个http://stackoverflow.com/questions/2811626/evaluate-empty-or-null-jstl-c-tags –
是的。和已经http://stackoverflow.com/questions/9103082/jstl-condition-with-multiple-operators,但仍然无法弄清楚我的代码段出了什么问题。它看起来很好,但没有正常工作 –
它不能正常工作?我没有看到任何明显的语法错误。 – Makoto