Loops 如何在JSTL中使用索引变量迭代LinkedHashMap
您能建议如何使用索引变量迭代LinkedHashMap吗。 重要的是,我使用索引变量来迭代映射。 我需要索引来访问同一映射中其他地方的值Loops 如何在JSTL中使用索引变量迭代LinkedHashMap,loops,jstl,linkedhashmap,Loops,Jstl,Linkedhashmap,您能建议如何使用索引变量迭代LinkedHashMap吗。 重要的是,我使用索引变量来迭代映射。 我需要索引来访问同一映射中其他地方的值 Map<String,List<String>> map = new LinkedHashMap<String,List<String>>(); Map Map=newlinkedhashmap(); 我已经编写了java代码。并努力在JSTL中转换此代码 int listcount = 8; fo
Map<String,List<String>> map = new LinkedHashMap<String,List<String>>();
Map Map=newlinkedhashmap();
我已经编写了java代码。并努力在JSTL中转换此代码
int listcount = 8;
for (Map.Entry<String, List<String>> entry : map.entrySet())
{
List<String> lst = new ArrayList<String>();
lst= entry.getValue();
System.out.println(":::::::"+entry.getKey()+":::::::");
for(int i=0;i<listcount;i++){
System.out.println(lst.get(i));
System.out.println(map.get(entry.getKey()+"New").get(i));
}
}
int listcount=8;
对于(Map.Entry:Map.entrySet())
{
List lst=new ArrayList();
lst=entry.getValue();
System.out.println(“:::”+entry.getKey()+”::::”;
对于(inti=0;我对不起,我已经弄明白了。
这是解决办法
<c:forEach items="${rmqList}" var="entry" varStatus="i">
<c:set var="editedfieldkey" value="${entry.key}New"/>
<tr>
<td>${entry.key}</td>
<c:forEach items="${entry.value}" var="item" varStatus="j">
<c:if test="${item ne null }">
<td>Value: ${item} <td>
<td>Edited Value ${rmqList[editedfieldkey][j.index]}</td>
</c:if>
</c:forEach>
</tr>
</c:forEach>
${entry.key}
值:${item}
编辑值${rmqList[editedfieldkey][j.index]}
<c:forEach items="${rmqList}" var="entry" varStatus="i">
<c:set var="editedfieldkey" value="${entry.key}New"/>
<tr>
<td>${entry.key}</td>
<c:forEach items="${entry.value}" var="item" varStatus="j">
<c:if test="${item ne null }">
<td>Value: ${item} <td>
<td>Edited Value ${rmqList[editedfieldkey][j.index]}</td>
</c:if>
</c:forEach>
</tr>
</c:forEach>