Display a list in a list with a foreach in jsp

后端 未结 3 1040
一整个雨季
一整个雨季 2021-01-26 00:27

Is it possible to display the elements of a list in a list with a foreach in a jsp?

List> elements;

i was thinking som

3条回答
  •  無奈伤痛
    2021-01-26 00:54

    for(Iterator i = someList.iterator(); i.hasNext(); ) {
      String item = i.next();
      System.out.println(item);
    }
    

    List implements the Iterable interface, so the above code should work.

提交回复
热议问题