我的p:對話框不斷加載,我只需要它出現一次。任何人都知道如何做到這一點?Primefaces p:對話框不斷重新打開
<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:
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;
}
我已經一個customAuthenticationProvider返回 'ATIVACAO' 時,數據庫是空的,所以我需要打開這個對話框插入數據,但它不斷重新打開(關閉立即重新打開)。
「on&on」是什麼意思?對話框加載頁面加載?它拒絕關閉?或者它關閉並立即重新打開?通常應該觸發對話的是什麼? – kolossus 2013-04-30 13:03:28
嗨kolossus,它關閉立即重新打開。謝謝。 – Kyne 2013-04-30 13:06:04
您需要在此處包含對話框的觸發器組件以用於上下文 – kolossus 2013-04-30 13:07:54