title: How to print javascript alert message in p:message of primefaces
body: <p>Javascript of my code</p>
  
  <pre><code>function checkPasswordMatch() {
      var password = document.getElementById("password").value;
      var confirmPassword = document.getElementById("confirmPassword").value;
  
      if (password != confirmPassword){       
          alert("Passwords do not match!");
      }else{
          alert("Passwords match.");
      }
  }
  </code></pre>
  
  <p>primefaces jsf code</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;h:panelGrid columns="2" id="matchGrid" cellpadding="5"&gt;                   
          &lt;h:outputLabel for="pwd1" value="Password 1: *" /&gt;
          &lt;p:password id="pwd1" value="password"  label="Password" required="true" /&gt;
          &lt;p:message for="pwd1"/&gt;
  
  
          &lt;h:outputLabel for="pwd2" value="Password 2: *" /&gt;
          &lt;p:password id="pwd2" value="confirmPassword" onkeyup ="checkPasswordMatch();" label="Confirm Password" required="true" /&gt;
          &lt;p:message for="pwd2"/&gt;
      &lt;/h:panelGrid&gt;
  
      &lt;p:commandButton update="matchGrid" value="Save" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>I want to print the alert message in p:message.. is it possible to do so..?? Please help</p>