title: Passing Values from a JSP page to a javascript function
body: <p>I have a jsp page that updates what is listed based on the selection in a box.  </p>
  
  <pre><code>&lt;form:select path="Value" id="select" onchange="update()" items="${Values}" /&gt;
  </code></pre>
  
  <p>And in another file the corresponding update function that populates based on what you selected and the item.  This works for one box, but I need to have multiple boxes, but copying the code into a for loop generates multiple boxes, but the update function only points to the id of the object "select".  I want to create a way to have select to be variable, so that it generates multiple objects with different values so that they don't point to the same thing.</p>
  
  <p>My thought was to just create a var and then have it count, so that at  id="select" can force it to create different objects... but the update function reads from the jsp with </p>
  
  <pre><code>var Val = $('#select option:selected').val();
  </code></pre>
  
  <p>In order to make them match, I need to pass parameters into the update() function, but when I fill in update method with parameters, the JSP can no longer call it.  I tried
     Update(var n) { //code here}<br>
  and
     Update(int n) {//Code here}</p>
  
  <p>But when the JSP statement runs update(//ValueIwant), it always throws the error of not finding the method. </p>
  
  <p>So my question is , how can I pass a parameter from a jsp page to the javascript function dynamically without  hardcoding all the values. </p>