我在 controller.java 中有以下 MultiHashMap
MultiHashMap multimap= new MultiHashMap();
List<SampleList> list1 = (List<SampleList>)
request.getPortletSession().getAttribute("list1");
Iterator<SampleList> sampleListIterator= list1.iterator();
while(sampleListIterator.hasNext()){
SampleList sampleList = sampleListIterator.next();
List <SubList> subList = sampleList.getsubList();
Iterator<SubList> subListIterator = subList.iterator();
while(subListIterator.hasNext() ){
SubList subList2 = subListIterator.next();
multimap.put(subList2.getCategorySubcategory(),subList2.getCost());
}
}
在 jsp 中,我有一个显示上述哈希图的表
<table>
<tbody>
<c:foreach var="item" items="${multimap}">
<tr>
<th> ${item.key}</th>
<c:foreach var="valueList" items=${item.value}>
<td> ${valueList}</td>
</c:foreach>
</tr>
</c:foreach>
</tbody>
</table>
当我尝试从控制器呈现值时出现错误。