Commandbutton with ajax = false does not redirect

UI Components for JSF
Post Reply
User avatar
FredMestre
Posts: 31
Joined: 07 Jul 2010, 22:29
Location: Teresina

30 Jul 2010, 14:40

I have the following page:

login.xhtml

Code: Select all

<h:form id="autenticacao">
                <p:focus />
                <p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();" />
                <p:dialog modal="true" widgetVar="statusDialog" header="Aguarde..." draggable="false" width="250" closable="false">
                    <p:graphicImage value="imagens/site/ajaxloadingbar.gif" />
                </p:dialog>
                <p:panel id="panelLogin" header="Autenticação">                    
                    <h:panelGrid columns="2">
                        <h:outputLabel value="Usuário:"/>
                        <h:inputText size="25" id="login" value="#{loginController.login}" required="true" requiredMessage="Infome o usuário" style="margin-left: 10px;" />
                        <h:outputLabel value="Senha:" />
                        <h:inputSecret size="25" id="senha" value="#{loginController.senha}" required="true" requiredMessage="Informe a senha" style="margin-left: 10px;"/>
                        <h:outputLabel value="Letras:" />
                        <h:inputText autocomplete="off" size="6" id="letras" value="#{loginController.letras}" required="true" requiredMessage="Informe as letras" style="margin-left: 10px;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <img alt="Validação de letras"  src="letras"/>                        
                        <p:commandButton update="msg" id="entrar" value="Entrar" action="#{loginController.autenticar}" ajax="false" style="margin-left: 90px;" image="entrar" />
                    </h:panelGrid>
                    <p:messages id="msg" />
                </p:panel>
</h:form>
LoginController.java

Code: Select all

public String autenticar() {
        if (validaUsuario()) {
            if (usuario.isTrocaSenha()) {
                return "senha?faces-redirect=true";
            } else {
                verificaPendencia();
                return "index?faces-redirect=true";
            }
        } else {
            return "login";
        }
    }
I need ajax=true to make ajaxStatus works. But i need ajax=false to make page redirect. This is a login form. What can i do :?:
  • Primefaces 2.2 Final
    Glassfish 3.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Jul 2010, 23:40


User avatar
FredMestre
Posts: 31
Joined: 07 Jul 2010, 22:29
Location: Teresina

04 Aug 2010, 15:08

2.1 Final
  • Primefaces 2.2 Final
    Glassfish 3.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Aug 2010, 12:40

This should have worked, can you post the partial ajax response? You can get it from firebug?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 43 guests