About Question com.enthuware.ets.scwcd.v5.2.56 :
Posted: Tue Jun 11, 2013 7:53 pm
The system marks this answer as correct:
I have tested this code and obtained correct output as well. So i guess this can be misleading.
Am I right with this?
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?