Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 如何遍历hashmap数据列表_Jsp_Loops_Hashmap - Fatal编程技术网

Jsp 如何遍历hashmap数据列表

Jsp 如何遍历hashmap数据列表,jsp,loops,hashmap,Jsp,Loops,Hashmap,我有hashmap的列表。我想遍历数据。请帮我举个例子。 我有一个表格,其中Y轴上有月份,X轴上有(MS_目标、HSD_目标、ALPG_目标、Lube_目标)等字段。 我的代码如下: List<Map<String, Integer>> ListofHash = new ArrayList<Map<String, Integer>>(); { for (int i = 0; i < 10; i++)

我有hashmap的列表。我想遍历数据。请帮我举个例子。 我有一个表格,其中Y轴上有月份,X轴上有(MS_目标、HSD_目标、ALPG_目标、Lube_目标)等字段。 我的代码如下:

 List<Map<String, Integer>> ListofHash = new ArrayList<Map<String, Integer>>();

        {

        for (int i = 0; i < 10; i++) 
          {
          Map<String, Integer> mMap = new HashMap<String, Integer>();

          mMap.put(String.valueOf(i), Integer.valueOf( + i));

          ListofHash.add(mMap); 
           }
      for (Map<String, Integer> map : ListofHash)
            {
            for (String key : map.keySet())
             {
               System.out.println(map.get(key));
          }
      }

HashMap <String,Integer> april= new HashMap <String,Integer>();

    april.put("aprMS",new Integer(1));
    april.put("aprHSD",new Integer(2));
    april.put("aprAlpg",new Integer(3));
    april.put("aprLubes",new Integer(4));

HashMap <String, Integer> may= new HashMap <String, Integer>();

    may.put("mayMS",new Integer(1));
    may.put("mayHSD",new Integer(2));
    may.put("mayAlpg",new Integer(3));
    may.put("mayLubes",new Integer(4));

}
Month         MS_Target     HSD_Target     ALPG_Target        Lubes_Target
April
May 
June
July 
August
September
October
November
December
January
February 
March

您可以在hashmap上使用迭代器,请参见此处:


谢谢你的帖子,我提到的上述代码正确吗???……你能给我一个与我的示例相关的示例代码吗。