我的动作类具有这样的对象数组,

Object[] varCount = (Object[]) countList.get(0);


和我的调试显示varCount的值。我将此对象数组放入模型中,如下所示:

model.put("varCount ", varCount );


在JSP中,我迭代如下:

<c:forEach var="varCount " items="${model.varCount }" varStatus="loop">
     <tr>
     <td align="center">&nbsp;<c:out value="${varCount[0]}"/></td>
</tr>
     </c:forEach>


而且我得到foll错误:

Wrapped exception:
javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "value" with value "${varCount [0]}": Unable to find a value for "0" in object of class "java.math.BigDecimal" using operator "[]" (null)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:306)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:16


我如何获得价值?

最佳答案

像这样使用获取所有数组对象

<c:forEach var="item" items="${model.varCount }" varStatus="loop">
 <tr>
 <td align="center">&nbsp;<c:out value="${item}"/></td>
  </tr>
 </c:forEach>

10-07 16:13