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