Iterate over an HashMap> with Struts 2

前端 未结 2 1253
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 05:12

I am currently facing some difficulties with Struts2 and the s:iterate tag.

I want to display a label, which is the key in the HashMap, followed by a table (the valu

2条回答
  •  鱼传尺愫
    2020-12-03 05:36

    
      

    The iterator of a map is Map.Entry which gets put on the value stack and has two accessors, getKey() and getValue(). Iterate over Entry printing the key, then iterate over the values printing the value. (The list item gets put on top of the value stack so s:property just prints the top.)

提交回复
热议问题