title: how to use javascript in jsp
body: <p>I want to call a javascript function that returns a value and then put that value in an if statement. There are two radio buttons in the HTML and the javascript checks to see which one is clicked. After that, the JSP compares it to either 'customers' or 'company' and does the appropriate SQL Query. </p>
  
  <p>Javascript:</p>
  
  <pre><code> function corc{
      var value;
  
      if(document.getElementById('cust').checked){
             value='customer';
              return value;
      }else if(document.getElmentById('comp').checked){
             value='company';
             return value;
      }
   }
  </code></pre>
  
  <p>JSP:</p>
  
  <pre><code>if(%&gt;corc();&lt;%.equals("customer")){
               String sqlqueryCommand = "SELECT * from customer where login='" + v1 + "' and password='" + v2     + "'";
  }else if (%&gt;corc();&lt;%.equals("company")){
               String sqlqueryCommand = "SELECT * from company where login='" + v1 + "' and password='" + v2     + "'";
  }
  </code></pre>