Hi all,
I have a for each loop that it works fine when the items property is filled using an scriplet in the following way:
<%
List<LandingCategory> cats = beanFactory.getLandingCategories();
%>
<c:forEach var="cat" items="<%=cats%>">
<c:out value="${cat.id}"/>
</c:forEach>
However, when trying to filled the items list with a param specified in another jsp file, the for each will not work.
JSP1
<jsp:include page="/jsp/modules/index/index_categories.jsp">
<jsp:param name="categories" value="<%=cats%>"/>
</jsp:include>
JSP2
<c:forEach var="cat" items="${param.categories}">
<c:out value="${cat.id}"/>
</c:forEach>
The following error is thrown:
javax.servlet.jsp.el.ELException: Unable to find a value for "id" in object of class "java.lang.String" using operator "."
It seems that it is considering the objects of the items list to be Strings, but I've no clue about why this is happening.
Does anyone has any idea?
Thanks