0

I hava to access a ArrayList of ArrayList of Custom objects on the jsp page from the struts2 action page:

private ArrayList<ArrayList<ProjectMemberDTO>> projectMember = new ArrayList<>();

I know how to access the ArrayList of Objects but I'm not able to deal with the above situation.

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243

1 Answers1

0
<s:iterator value="projectMember" var="currentMember">
    <br>-Occurrence of the outer ArrayList
    <s:iterator value="#currentMember">
        <br>----Occurrence of the inner ArrayList; my object value: 
        <s:property value="myObject.myAttribute" />
    </s:iterator>
</s:iterator>

But you should consider migrating to a more structured object, because this seems unnecessarily noisy.

Also consider that

  • a list should be called projectMembers, since they're more,
  • for the declaration should be used the interface List, not the implementation ArrayList
  • while you can iterate in the page any kind of structure, a List of Lists can't be sent back to the action. Then, again, consider restructuring it a bit.
Community
  • 1
  • 1
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243