小编Asp*_*ect的帖子

Primefaces p:对话框不断重新打开

我的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>
    ...
Run Code Online (Sandbox Code Playgroud)

按钮:

  <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>
Run Code Online (Sandbox Code Playgroud)

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;
     }
Run Code Online (Sandbox Code Playgroud)

我有一个customAuthenticationProvider在数据库为空时返回'ATIVACAO',所以我需要打开此对话框来插入数据,但它会一直重新打开(关闭立即重新打开).

jsf primefaces jsf-2

6
推荐指数
1
解决办法
1394
查看次数

标签 统计

jsf ×1

jsf-2 ×1

primefaces ×1