I have an arraylist containing some fields values of which i need to display in text fields. I am using spring form for this purpose. My area of concern i am not being able to display the field values because there is a parent bean in place. I know we can do something like this form:input path="xxx" value="${arraylist.get(0).element}" , however i am not being able to understand how to access the elements when they are wrapped in a parent bean. Please help!
1 Answer
Assuming you have a wrapper parent bean, which contains Child instances in it:
class Parent{
Child child;
...
}
and assuming you have a list containing instances of this Parent; you can display the properties of child as below:
<c:forEach var="parent" items="${parents}" varStatus="status">
<form:input path="parents[${status.index}].child.childProperty" />
</c:forEach>