我需要在对象内迭代一个列表。附加图像,其中包含对象如何进入调试模式。这是我的代码。
JSP:
<div class="sample">
<c:forEach items="${mapPlotMaster}" var="mapplotter">
<c:forEach items="${mapplotter}" var="customer">
<li>${customer.cust_zip}</li>
</c:forEach>
</c:forEach>
</div>
控制器:
model.addAttribute("mapPlotMaster", mapPlotMaster);
堆栈跟踪:
org.apache.jasper.JasperException: JBWEB004038: An exception occurred processing JSP page /WEB-INF/views/maps/mapplot.jsp at line 32 32 29: </div> 30: 31: <div class="sample"> 32: <c:forEach items="${mapPlotMaster}" var="mapplotter"> 33: <c:forEach items="${mapplotter}" var="customer"> 34: <li>${customer.cust_zip}</li> 35: </c:forEach> Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:456)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:402)
答案 0 :(得分:0)
您的mapPlotMaster对象是否可迭代?如果没有,则不能迭代主对象,只是它的数组属性。
我想你想要实现的是:
<div class="sample">
<c:forEach items="${mapPlotMaster.mapplotter}" var="customer">
<li>${customer.cust_zip}</li>
</c:forEach>
</div>