的Tomcat 7 JDK7的forEach返回一個字符串不是一個對象
class Product
private java.util.List<OrderedProduct> childProducts; // with getter and setter
JSTL
<c:forEach var="product" items="${sessionScope.products}">
<c:forEach var="child" items="${product.childProducts} ">
<c:out value="${child}" />
</c:forEach>
</c:forEach>
的inital的forEach返回一個對象,我可以調用$ {} product.id上,但是孩子始終是一個串。我在網上發現的唯一提到的是在forEach中缺少$ {},但我擁有這些。任何其他原因JSTL不會返回實際的對象?
你是什麼意思「小孩總是一個字符串」? 'c:out'輸出任何對象所在的'toString()'。 –
內部列表也是產品類別的列表 – user18896654353
所有的非集合值,如id,這是什麼id給我 - > javax.el.PropertyNotFoundException:在類型java.lang.String上找不到屬性'id' – user18896654353