I am new to spring mvc framework and I am facing an issue in getting the values from the view in controller.
Please find below the code.

Here is the jsp:

```
<form:form action="envDetails" method="POST" commandName="enviromentForm">
<c:forEach items="${enviromentForm.environments}" varStatus="i" var="env">
        Name of Environment<c:out value="${(i.index)+1}"/>:
       <form:input path="environments[${i.index}].name" type="text"/>
       <br>
       Path of Environment<c:out value="${(i.index)+1}"/>  :
       <form:input path="environments[${i.index}].path" type="text"/>
       <br><br>
</c:forEach>
<input class="submitStyle" type="submit" value="SUBMIT" />
</form:form>

```

This is my controller:

```
@RequestMapping(value="envDetails",method=RequestMethod.GET)
public ModelAndView setBackingForm(HttpServletRequest request) {
    EnviromentForm envf=new EnviromentForm();
    envf.setProjectName("Test");
    for(int i=0;i<2;i++) {
        envf.add(new Enviroment());
    }
    return new ModelAndView("envDetails","enviromentForm",envf);
}

@RequestMapping(value = "envDetails", method = RequestMethod.POST)
public ModelAndView viewFolderInput(
        @ModelAttribute("enviromentForm") EnviromentForm enviromentForm,BindingResult binding,WebRequest request, SessionStatus status) {

    ***//here I am not receiving the values in enviromentForm***
}

```

This is EnviromentForm class:

```
public class EnviromentForm {

private String projectName;
private List<Enviroment> environments;

public EnviromentForm() {
    environments = new ArrayList<>();
}

public EnviromentForm(String projectName, List<Enviroment> environments) {
    this.projectName = projectName;
    this.environments = new ArrayList<>();
    this.environments.addAll(environments);
}

//getter setter

public void add(Enviroment env) {
    this.environments.add(env);
}

}

```

and this is Enviroment class:

```
public class Enviroment {
private String name;
private String path;

//getter setter

}

```

Any help is much appreciated.