How to access each arraylist within arraylist with thymeleaf?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to access each arraylist within arraylist with thymeleaf?

gbvikas@gmail.com
There are Three classes:

Public Class Port{

private String portname;
// with getters and setters
}

Public Class Application{
private String appName;
private List<Port> ports=  new ArrayList<Port>();
//  with getters and setters
}

Public Class Service{
private String serviceName;
private List<Application> apps=  new ArrayList<Application>();
//  with getters and setters
}

Below snippet is part of the Thymeleaf HTML code to iterate through the fields.

<form action="#" th:action="@{/processWrapper}" th:object="${service}" method="post">
<div th:each="app, stat : *{apps}">
                    <div th:each="port, stat1 : *{app.ports}">
    </div>
    </div>
<input type="text" th:field="*{apps[__${stat.index}__].appName}" th:name="|apps[${stat.index}]|" /><input type="text" th:field="*{app.ports[__${stat1.index}__].portname}" th:name="|app.ports[${stat1.index}]|" />
</form>

Its not working. How do I loop arraylist within arraylist?
Reply | Threaded
Open this post in threaded view
|

Re: How to access each arraylist within arraylist with thymeleaf?

Metroids