私の p:dialog はロードし続けます。一度だけ表示する必要があります。誰でもそれを行う方法を知っていますか?
<h:body style="background: url('img/background/teste/brushed_alu.png')!important" onload="dialogAtivacao.show();">
<script type="text/javascript">
$(document).ready(function() {
document.getElementById("j_username").focus();
});
</script>
<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'}">
<ui:include src="pages/ativacao/AtivacaoEmpresa.xhtml"/>
</p:dialog>
...
ボタン:
<p:panel styleClass="panelBotaoLogin" >
<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"/>
</p:panel>
LoginBean の login() :
public String doLogin() throws IOException, ServletException {
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
RequestDispatcher dispatcher = ((ServletRequest) context.getRequest()).getRequestDispatcher("/j_spring_security_check?j_username=" + username + "&j_password=" + password);
dispatcher.forward((ServletRequest) context.getRequest(), (ServletResponse) context.getResponse());
FacesContext.getCurrentInstance().responseComplete();
return null;
}
データベースが空のときに「ATIVACAO」を返す customAuthenticationProvider が 1 つあるため、このダイアログを開いてデータを挿入する必要がありますが、再開し続けます (閉じてすぐに再開します)。