title: In MVC how is the data passed from JSP to Controller?
body: <p>I'm following the Spring MVC tutorial here: <a href="http://www.tutorialspoint.com/spring/spring_mvc_form_handling_example.htm" rel="nofollow">http://www.tutorialspoint.com/spring/spring_mvc_form_handling_example.htm</a>
  and I'm not getting the logic how is the data passed from JSP to Controller.</p>
  
  <p>I think I understand how the data is passed from the Controller to the JSP, but after the user has edited the form on the JSP how is the data passed to the Controller?</p>
  
  <p>In the controller:
  public String addStudent(@ModelAttribute("SpringWeb")Student student, ModelMap model)</p>
  
  <ol>
  <li>question:
  How the controller knows that from the form on the jsp Student class instance student with name, age and id are passed?</li>
  </ol>
  
  <p>I have this example working. I have altered the example to display a list of students, but I am not able to get the list from JSP to Controller:</p>
  
  <pre><code>@RequestMapping(value = "/student", method = RequestMethod.POST)
  public ModelAndView studentSave(@ModelAttribute("listOfStudents") ArrayList&lt;Student&gt; listOfStudents,ModelMap model)
  {
      ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
  
          StudentJDBCTemplate studentJDBCTemplate = (StudentJDBCTemplate) context.getBean("studentJDBCTemplate");
  
          System.out.println("Size of listOfStudents is = " + listOfStudents.size());
  ...
  </code></pre>
  
  <p><code>listOfStudents.size()</code> returns 0.</p>
  
  <ol start="2">
  <li>question: what am i missing here, why I can't get the list from the form on the jsp?</li>
  </ol>