我的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