title: Ajax in JSF load all page
body: <p>I have a authentication form , When I click on command button it should refresh the form in case the login is failed , else  redirect the user </p>
  
  <p>I create ajax inside commandButton to check if login is failed , if it is the OutputText will change to : Login failed </p>
  
  <p>I don't what I need to modify to make it work</p>
  
  <p>Here my JSF , </p>
  
  <pre><code>    &lt;h:form id="form_login" &gt;
      &lt;div&gt;
      &lt;!-- email --&gt;
     &lt;div class="input-group input-group-sm"&gt;
     &lt;h:inputText id="mail" type="text" class="form-control" placeholder="Email" value="#{login.mail}"  required="true" requiredMessage="Entrez votre mail svp" validatorMessage="Email invalide"&gt;
  &lt;f:ajax event="keyup" render="messageerreur" /&gt;
  &lt;f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" /&gt; &lt;/h:inputText&gt;
  &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt;&lt;/span&gt;
   &lt;/div&gt;
   &lt;h:message id="messageerreur" for="mail" class="recover-password" style="color:#eb6a5a" /&gt;
       &lt;!--  Password --&gt;
   &lt;div class="input-group input-group-sm"&gt;
   &lt;h:inputSecret id="password" class="form-control" placeholder="Password" value="#{login.pass}" required="true"  requiredMessage="Entrez votre password svp" &gt; 
  &lt;/h:inputSecret&gt;
   &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-times"&gt;&lt;/i&gt;&lt;/span&gt;
   &lt;/div&gt;
   &lt;h:message  id="erreurpass" for="password" class="recover-password" style="color:#eb6a5a" /&gt;
  &lt;/div&gt; 
   &lt;br&gt;&lt;/br&gt;
                                  &lt;div class="pull-right"&gt;
  &lt;h:commandButton id="login_button"  action="#{login.authentification()}" value="Login" class="btn btn-login"&gt;
   &lt;f:ajax onevent="click"  execute="form_login" render="login_failed"/&gt; 
    &lt;/h:commandButton&gt;&lt;/div&gt;
  &lt;div class="center"&gt;                          
  &lt;h:outputText id ="login_failed" class="recover-password" value="#{login.failed}" /&gt;
   &lt;/div&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Here the Function in managed Bean : </p>
  
  <pre><code>public String authentification()
      {
          System.out.println("Hi");
          System.out.println(getMail());
          System.out.println(getPass());
          if(getMail()!=null &amp;&amp; getPass()!=null)
          {
          login_success=marchandBo.authentication(getMail(), getPass());
          }
          if(login_success)
              return "Dashboard_user.xhtml";
          else
              setFailed("Login failed");
  
          return null;
      }
  </code></pre>