title: Retrieve values from JSP to Javascript
body: <p>Below is the javascript on my JSP page:</p>
  
  <pre><code>&lt;SCRIPT language="JavaScript"&gt;
  function checkPass(){
  
  var pass1=request.getParameter('password');
  var pass2=request.getParameter('password2');
  
      if (pass1==pass2){
          window.alert("YES");
      }
      else{
          window.alert("NO");
      }
      }
  &lt;/SCRIPT&gt;
  </code></pre>
  
  <p>Below is my form input text boxes:</p>
  
  <pre><code>                    &lt;h:outputLabel value="Password:" for="password" /&gt;
   &lt;h:inputSecret id="password" value="#{StaffController.staff.password}" 
              size="20" required="true"
              label="Password" &gt;
              &lt;f:validateLength minimum="8" /&gt;
          &lt;/h:inputSecret&gt;
  
          &lt;h:message for="password" style="color:red" /&gt;
  
                      &lt;h:outputLabel value="Password:" for="password2" /&gt;
   &lt;h:inputSecret id="password2" 
              size="20" required="true"
              label="Password" &gt;
              &lt;f:validateLength minimum="8" /&gt;
          &lt;/h:inputSecret&gt;
   &lt;h:message for="password2" style="color:red" /&gt;
  </code></pre>
  
  <p>Below is my commandbutton linked with onmousedown to call the script when clicked:</p>
  
  <pre><code>&lt;h:commandButton action="#{StaffController.saveUser()}" onmousedown="checkPass();" value="Submit"/&gt;
  </code></pre>
  
  <p>I can't seem to retrieve value from my user input form.</p>