title: Spring MVC adding a row dynamically to JSP. javascript Vs controller
body: <p>I am designing an intranet application with Spring MVC3. I have to create a JSP page which has a data grid which is populated form the database and user and can add rows in the JSP data grid. I was considering the following two options:</p>
  
  <ol>
  <li>To use javascript function to add a row on an "Insert Row" button</li>
  <li>To submit the form on "Insert Row" button, go to Controller and return a model attribute with an extra row.</li>
  </ol>
  
  <p>I am more bent towards the controller approach, as I feel I have better control on the datatable in the controller.</p>
  
  <p>Can you please suggest which would be a better approach considering some of cells of the new row may need to be set with some default value.</p>
  
  <p>Please note that I cannot use jQuery or any other javascript library.</p>