【发布时间】:2016-09-07 09:00:46
【问题描述】:
我正在构建一个 Spring MVC Web 应用程序,我有一个名为 NodeRel 的对象,其定义如下:
public class NodeRel {
private String fromNodeId;
private String toNodeId;
private String fromNodeName;
private String toNodeName;
private List<QuotaValueOnTime> fromNodeSend;
private List<QuotaValueOnTime> toNodeSend;
//getters and setters omitted
}
在服务器端代码中,我获得了一个 NodeRels 列表并将其绑定到模型。在 jsp 页面中,我想先循环遍历 List,然后在其中循环遍历 List。我的jsp代码:
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class="center">Count</th>
<th>relation</th>
<th colspan='25'>Detail</th>
</tr>
</thead>
<tbody>
<c:forEach var="nodeRel" items="${nodeRelInfo}" varStatus="stc">
<tr>
<td rowspan="3">${stc.count}</td>
<td rowspan="3">${nodeRel.fromNodeName} --> ${nodeRel.toNodeName}</td>
<td>\</td>
<c:forEach var="x" begin="0" end="23" step="1">
<td>${x}</td>
</c:forEach>
</tr>
<tr>
<td>Send_A</td>
<c:forEach var="node" items="${nodeRelInfo.fromNodeSend}">
<td>${node.sumval}</td>
</c:forEach>
</tr>
<tr>
<td>Send_B</td>
<c:forEach var="x" begin="0" end="23" step="1">
<td>${x}</td>
</c:forEach>
</tr>
</c:forEach>
</tbody>
</table>
</div>
我的代码不起作用,我得到 java.lang.NumberFormatException: For input string: "fromNodeSend" 在第二个循环附近:
<c:forEach var="node" items="${nodeRelInfo.fromNodeSend}">
<td>${node.sumval}</td>
</c:forEach>
我的代码有什么问题?
【问题讨论】:
标签: java spring jsp spring-mvc jstl