I have an instance of the following class what i would like to edit in a from, and then save it back at the backend.
public class NestedClass {
List<InnerClass> inners = new LinkedList<InnerClass>();
//getter and setter
public class InnerClass {
private String innerField;
//getter and setter
}
}
EDIT: sample code edited to meet @Slava Semushin's advice.
When i instantiate the class and pass it to the model i can read the values with the following jsp snippet:
<form:input path="inners[0].innerField" /><br/>
<form:input path="inners[1].innerField" /><br/>
But when i pass it back i get the following exception:
Invalid property 'inners[0]' of bean class [com.sodacrm.webapp.forms.NestedClass]: Illegal attempt to get property 'inners' threw exception; nested exception is org.springframework.beans.NullValueInNestedPathException: Invalid property 'inners' of bean class [com.sodacrm.webapp.forms.NestedClass]: Could not instantiate property type [com.sodacrm.webapp.forms.NestedClass$InnerClass] to auto-grow nested property path: java.lang.InstantiationException: com.sodacrm.webapp.forms.NestedClass$InnerClass
org.springframework.beans.InvalidPropertyException: Invalid property 'inners[0]' of bean class [com.sodacrm.webapp.forms.NestedClass]: Illegal attempt to get property 'inners' threw exception; nested exception is org.springframework.beans.NullValueInNestedPathException: Invalid property 'inners' of bean class [com.sodacrm.webapp.forms.NestedClass]: Could not instantiate property type [com.sodacrm.webapp.forms.NestedClass$InnerClass] to auto-grow nested property path: java.lang.InstantiationException: com.sodacrm.webapp.forms.NestedClass$InnerClass
The real class what i'm using is 3 levels deep and i don't want to put the inner classes to separate files because they are strongly belong to their outter classes...