When you say colors.get(1); or ${element[1]} , it actually refers to one entry in the list. But when you use c:forEach , it iterates through the loop. It depends on what you are trying to achieve. If you just want the Nth element to try to execute
<c:out value="${colors[1]}"/>
but you want to print all the elements you should use for the loop, for example
<c:forEach items="${colors}" var="element"> <c:out value="${element}"/> </c:forEach>
Also note that if you write as <c:forEach items="colors" var="element"> , it literally treats the value as "colors" . Therefore, if this is a variable name, you must specify it in ${} as ${colors} , as shown in the example above.
source share