title: Primefaces p:dialog keeps reopening
body: <p>My p:dialog keeps loading on and on, i need it to appear only once. Anyone know how to do it?</p>
  
  <pre><code>    &lt;h:body style="background: url('img/background/teste/brushed_alu.png')!important" onload="dialogAtivacao.show();"&gt;
      &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          document.getElementById("j_username").focus();
      });
      &lt;/script&gt;
  
      &lt;p:dialog id="dialogAtivar" header="Ativação de empresa"  showEffect="drop" hideEffect="drop" resizable="false"
                widgetVar="dialogAtivacao" modal="true" closable="true" rendered="#{sessionScope['SPRING_SECURITY_LAST_EXCEPTION'].message == 'ATIVACAO'}"&gt;
          &lt;ui:include src="pages/ativacao/AtivacaoEmpresa.xhtml"/&gt;
      &lt;/p:dialog&gt;
      ...
  </code></pre>
  
  <p>The button:</p>
  
  <pre><code>  &lt;p:panel  styleClass="panelBotaoLogin" &gt;
          &lt;h:commandButton id="saveButton" action="#{login.doLogin()}" value="  Entrar" styleClass="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only botaoEntrar"/&gt;
    &lt;/p:panel&gt;
  </code></pre>
  
  <p>The login() in LoginBean :</p>
  
  <pre><code>    public String doLogin() throws IOException, ServletException {
             ExternalContext context =  FacesContext.getCurrentInstance().getExternalContext();
             RequestDispatcher dispatcher = ((ServletRequest) context.getRequest()).getRequestDispatcher("/j_spring_security_check?j_username=" + username + "&amp;j_password=" + password);
             dispatcher.forward((ServletRequest) context.getRequest(), (ServletResponse) context.getResponse());
             FacesContext.getCurrentInstance().responseComplete();
  
             return null;
       }
  </code></pre>
  
  <p>I have one customAuthenticationProvider that returns 'ATIVACAO' when database is empty, so i need open this dialog to insert data, but it keeps reopening(closes an immediately reopens).</p>