2 Replies Latest reply on Mar 19, 2013 7:15 AM by michpetrov

    <h:commandLink> action not invoke if include with <ui:include>

    songjinglim

      Hi

       

      If I place <h:commandLink> inside an include file, the action will not call back bean.

       

      Main File:

       

          <h:form id="ifLogin">

              <h:panelGrid

                  rendered="#{userSession.isLogin}"

                  columns="2" columnClasses="columnAlignLeft, columnAlignRight"

                  border="0" cellpadding="0">

       

                  <ui:include src="\test.xhtml" />       

       

              ...

       

              </h:panelGrid>

          </h:form>

       

      Include file (test.xhtml)

       

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

          <ui:composition 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:a4j="http://richfaces.org/a4j"

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

       

              <h:panelGrid border="0" columns="4">

                  <h:graphicImage value="#{msg.urlImageHome}"

                      style="height:26px;width:26px;" />

                  <f:subview>               

                      <h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"

                          action="#{pageNavigationBean.updateCeaAppName}">

                          <f:param name="requestName" value="CEA_MAIN_PAGE" />

                          <f:param name="ceaAppName" value="" />      

                      </h:commandLink>   

                  </f:subview>

              </h:panelGrid>   

          </ui:composition>

       

      The workaround is take out include file, directly place the <h:commandLink> code to main file as below:

       

      Main file (without using include)

       

          <h:form id="ifLogin">

              <h:panelGrid

                  rendered="#{userSession.isLogin}"

                  columns="2" columnClasses="columnAlignLeft, columnAlignRight"

                  border="0" cellpadding="0">

       

       

                  <h:panelGrid border="0" columns="4">

                      <h:graphicImage value="#{msg.urlImageHome}"

                          style="height:26px;width:26px;" />

                      <f:subview>               

                          <h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"

                              action="#{pageNavigationBean.updateCeaAppName}">

                              <f:param name="requestName" value="CEA_MAIN_PAGE" />

                              <f:param name="ceaAppName" value="" />      

                          </h:commandLink>   

                      </f:subview>

                  </h:panelGrid>           

       

              ...

       

              </h:panelGrid>

          </h:form>

       

       

      I use richface 4.3.1  Odd is this problem not happen when I run from local GAE.  After deploy online to GAE, problem occour (i.e if using include then <h:commandLink> action will not trigger. 

       

      Is that a bug in jsf? or richface implementation or GAE?  Any help?

        • 1. Re: <h:commandLink> action not invoke if include with <ui:include>
          songjinglim

          Problem identify

           

          It is not cause by using <ui:include>

           

          The problem came out when the include file is dynamic generate from back bean, for example:

           

          <ui:include src="#{pageNavigationBean.appDropDownMenuUrl}" />

           

          If explicit mention the url, it work, for example:

           

          <ui:include src="\test.xhtml" />    

           

          Well, if running from my local GAE, both way are working but when deploy online, I need use explicit location instead generate from bean.  May be that is due to GAE problem where state is save at Client side (javax.faces.STATE_SAVING_METHOD).

          1 of 1 people found this helpful
          • 2. Re: <h:commandLink> action not invoke if include with <ui:include>
            michpetrov

            Hi,

             

            make your pageNavigationBean @ApplicationScoped and it should work. It's an issue with JSF.

            1 of 1 people found this helpful