1 Reply Latest reply on Mar 23, 2013 6:40 AM by songjinglim

    After redirect, <f:selectItems> can't get the value

    songjinglim

      This situation is ood when I deploy to GAE.  It work fine on my local.  Don't know is that due to GAE only store session on client.

       

      Well, after using Google authentication, it redirect back to my xhtml page.  From there it will call a backbean and redirect to other pages based on condition.

       

         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

          <html xmlns="http://www.w3.org/1999/xhtml"

              xmlns:h="http://java.sun.com/jsf/html"

              xmlns:f="http://java.sun.com/jsf/core"

              xmlns:ui="http://java.sun.com/jsf/facelets"

              xmlns:rich="http://richfaces.org/rich"

              xmlns:a4j="http://richfaces.org/a4j">

         

          <h:head>

              <script>

                  function myfunc() {

                      var buttonvar = document.getElementById("googleLoginForm:loginButton");

                      buttonvar.click();

                  }

              </script>

          </h:head>

          <body onload="myfunc()">

              Google account login success... please wait while processing your CEA account....

              <h:form rendered="true" id="googleLoginForm">

                  <h:commandButton value="submit" id="loginButton" type="submit" immediate="true" style="visibility:hidden;"

                      action="#{guestSupportBean.authenticationGoogle}">

                      <f:param name="resultComponentId" value="googleLoginLink" />   

                  </h:commandButton>

              </h:form>

          </body>

          </html>

       

      This work fine and in faces-config, for that xhtml (googleIdLogin) if return value is REQUEST_USER_PROFILES_SELECTION, then it will redirect to userProfilesSelection.xhtml.  And #{userProfileSelectionBean.userProfiles} will be init during the back bean action (#{guestSupportBean.authenticationGoogle}).

       

          <navigation-rule>

              <display-name>googleIdLogin</display-name>

              <from-view-id>/public/idm/googleIdLogin.xhtml</from-view-id>

              <navigation-case>

                  <from-outcome>REQUEST_USER_PROFILES_SELECTION</from-outcome>

                  <to-view-id>/public/idm/userProfilesSelection.xhtml</to-view-id>

                  <redirect />

              </navigation-case>

          <navigation-rule>

       

      userProfileSelection.xhtml will display a list of user profiles in drop down selection, this work fine on my local but not when deploy to GAE.

       

          <rich:select id="userProfile"

              value="#{userProfileSelectionBean.userProfileUid}"

              defaultLabel="#{msg.clickToSelect} #{msg.title}">

              <f:selectItems value="#{userProfileSelectionBean.userProfiles}" />

          </rich:select>

         

          <h:commandButton value="#{msg.selectUserProfile}" type="submit"

              action="#{userProfileSelectionBean.selectUserProfile}">

          </h:commandButton>

       

      I try to printout the bean value, it is null seem like I receive another bean after redirect.

       

      Well...  if I take out indirect using forward.  Now the <f:selectItems> will have value.  The problem is the the commonButton didn't trigger call to back bean action (#{userProfileSelectionBean.selectUserProfile}".

       

      Here the summary:

      - if using redirect then the <f:selectItems> will not get the value

      - if not using redirect, <f:selectItems> fill with the value but <h:commandButton> not trigger bean bean action.