4 Replies Latest reply on Mar 11, 2008 4:16 PM by Ziphyre Marco

    Page navigation and forms

    Ziphyre Marco Newbie


      I don't know if this is a seam issue or my JSF knowledge is missing but since page flow is in pages.xml, I'll put it here.

      I got a login.xhtml page, who's responsible of logins, but also if a user has a invitation code, he can register himself as a new user providing that code. So I got two commandButton on the form, one for the login, one for the beginRegistration.

      The problem is, when I try to register as a new user, providing the code, and clicking  the Register button, the login method also gets called and fails obviously. So even though the beginRegistration action succeed and returns "register", the login.xhtml page is redisplayed with login failed message. I don't know why the identity.login action  gets called even though it's not clicked.

      Any suggestion?


      PS: I tried to include some code samples, the form and the login.page.xml file, but I get the 400 request failed error constantly. So I gave up...

        • 1. Re: Page navigation and forms
          James Kelly Newbie

          We need your view XHTML and your navigation rules. Did you try including the XML inside backticks?

          • 2. Re: Page navigation and forms
            Ziphyre Marco Newbie

            Yep, I tried with and without the xml's, I'll try again with one code snippet at a time:

            <?xml version="1.0" encoding="UTF-8"?>
            <page xmlns="http://jboss.com/products/seam/pages"
                  xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd" >      
                 <navigation from-action="#{identity.login}">
                    <rule if="#{identity.loggedIn}">
                         <redirect view-id="/home.xhtml"/>
                 <navigation from-action="#{registration.beginRegistration}">
                      <rule if-outcome="register">
                         <redirect view-id="/register.xhtml"/>

            • 3. Re: Page navigation and forms
              Ziphyre Marco Newbie
                      <h:outputLabel for="username">GSM No:</h:outputLabel>
                      <h:inputText id="username" value="#{identity.username}"/>
                      <h:outputLabel for="password">Password</h:outputLabel>
                      <h:inputSecret id="password" value="#{identity.password}"/>
                      <h:commandButton value="Login" action="#{identity.login}"/>
                      <h:outputLabel for="invitation">Invitation Code</h:outputLabel>
                      <h:inputText id="invitation" value="#{invitation.code}"/>
                      <h:commandButton value="Register" action="#{register.beginRegistration}"/>

              • 4. Re: Page navigation and forms
                Ziphyre Marco Newbie

                Ok, the fault is in the login.page.xml file

                <navigation from-action="#{registration.beginRegistration}"> should be

                <navigation from-action="#{register.beginRegistration}">

                Now my navigation works ok, but I still get in the logs the authentication failed message? So my login gets called? Why is that?