title: Process form data with Java
body: <p>I'm currently working on a Java web application which will take data submitted by a user (from a form) and write it to a database. The input page is a JSP file with lots of textboxes, dropdowns, textareas, etc. I would like to know how to go about processing data from the form and putting it into a database when the form could have a variable number of inputs.</p>
  
  <p>I'll give you an example that illustrates my problem: A user has multiple phone numbers that they want to give us. On the form, there is a single input box for phone number, and an "add" button which uses JQuery to add another phone number input box. When the user submits the form, a servlet receives all the data. At this point, what is the most robust way to process this data so that I can add it to the database? My first thought would be to have the javascript increment the name of the phone number box (ex: "phonenumber1", "phonenumber2", etc) and have the servlet loop through the inputs, but it seems like their should be a more robust way to do it. I would really appreciate any advice I can get. Thanks!</p>
  
  <p>Edit: spelling</p>