I am sending list of grouped fields to Spring controller using Spring form tag. Some of these can be empty. For example
JSP Page has
<form:input path="id" size="30" value=""/>
<form:input path="name" size="30" value=""/>
<c:forEach var="i" begin="0" end="4">
<form:input path="myLog[${i}].dateOfCall" size="10" value=""/
<form:input path="myLog[${i}].activity" size="30" value=""/>
</c:forEach>
My Model fields looks like
Class MyModel {
String name;
String id;
List<MyLog> myLog;
public static class MyLog {
String dateOfCall;
String activity;
}
Now event when I don't filled any myLog I am getting all 5 myLog object with empty values.
So my question is there a way to make myLog size depending upon the number of log user input. For example if user input no log info its size should be 0.