When you say colors.get(1);
or ${element[1]}
its actually referrign to single entry in the list. But when you use c:forEach
its iterating the loop.
It depends on what you are trying to achieve. If you just want the Nth element try
<c:out value="${colors[1]}"/> // This prints the second element of the list
but rather you want to print the entire elements you should go for loop like
<c:forEach items="${colors}" var="element">
<c:out value="${element}"/>
</c:forEach>
Also please note if you write like <c:forEach items="colors" var="element">
it literally treat the value as "colors"
. So if its a variable name you need to give it in ${}
like ${colors}
as depicted in example above.