With the following note:The EL code within the body of the tag may refer to the iteration variable but scripting code cannot.
But I guess its WRONG, because the scripting code can access the iteration variables as follows:For example, <%=dept.getName()%> is invalid here:
<c:forEach var="dept" items="${departments}">
<c:out value="${dept.name}"/><br><%=dept.getName()%>
</c:forEach>
Code: Select all
<c:forEach var="str" items="${arr}" varStatus="status">
<c:out value="${str}"/><br>
<c:out value="${status.count}"/><br>
Now with scriptlet:<br>
<%=pageContext.getAttribute("status")%><br>
<%=((String)pageContext.getAttribute("str")).toUpperCase()%><br>
</c:forEach>
Am I right with this?