4 Replies Latest reply on Nov 15, 2007 4:53 AM by Achim Grimm

    Tab-Panel and inner Forms submitted within a Tab

    Achim Grimm Newbie

      Hi,

      I have just upgraded to Richfaces version 3.1.2 from version 3.0.1.
      I am using faclets version 1.2.
      I have encountered the following problem with a page like this:

      ...
      <rich:tabPanel switchType="server">
       <rich:tab label="MyTab">
       <a4j:form>
       <a4j:commandButton action="CALL_MY_ACTIONLISTENER" value="ActionListener test" />
       </a4j:form>
       </rich:tab>
      </rich:tabPanel>
      ...
      

      There is no form-tag outsite the tabPanel.

      Before the update, my custom ActionListener I have registered within the faces-config.xml was called after clicking the button. After the update, this is no the case.
      I have traced it down to the fact, that the commandButton's decode method is not called. It seems to have something to do with the tabPanel surounding the form. If I remove the TabPanel, everything works like normal.

      Now, I am wondering if this behavour is a wanted one?

      With best regards and in hope of a soon answer.
      Achim Grimm

        • 1. Re: Tab-Panel and inner Forms submitted within a Tab
          Ilya Shaikovsky Master

          hm.. could you please more code (I mean faces-config and method itself).

          Are you updated facelets together with RF? May be the problem there? I'm still not tested with 1.2 but I will after you give me rest of code snippets.

          • 2. Re: Tab-Panel and inner Forms submitted within a Tab
            Achim Grimm Newbie

            Hi Ilya,
            thanks for the fast reply.

            I have only upgraded RF. Here is the part of the faces-config.xml:

            <?xml version="1.0"?>
            <faces-config
            xmlns="http://java.sun.com/xml/ns/javaee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
            version="1.2">
             <application>
             <view-handler>
             de.MyViewHandler
             </view-handler>
             <navigation-handler>
             de.MyNavigationHandler
             </navigation-handler>
             <property-resolver>
             de.MyCompositeELResolver
             </property-resolver>
             <action-listener>
             de.MyActionListener
             </action-listener>
             </application>
            </faces-config>
            


            I have shorted the packagenames for better reading. I have changed quite a lot of the code normally used. But the normal facelets Lifecycle behavour is still used to handle all requests.

            Hope this helps. Let me now if you need more information.

            Best regards.
            Achim Grimm

            • 3. Re: Tab-Panel and inner Forms submitted within a Tab
              Ilya Shaikovsky Master

              My Page

               <rich:tabPanel>
               <rich:tab label="test 1">
               <h:form>
               <h:commandButton action="inputname" value="test"></h:commandButton>
               </h:form>
               </rich:tab>
               <rich:tab label="test 2">
               <h:outputText value="tab2"></h:outputText>
               </rich:tab>
               </rich:tabPanel>
              


              My ActionListener
              public class actionList implements ActionListener{
               public actionList() {
               }
              
               public void processAction(ActionEvent event)
               throws AbortProcessingException {
               System.out.println("global listener fired");
               String outcome = ((ActionSource2)event.getComponent()).getActionExpression().invoke(FacesContext.getCurrentInstance().getELContext(), new Object[]{}).toString();
               NavigationHandler handler = FacesContext.getCurrentInstance().getApplication().getNavigationHandler();
               handler.handleNavigation(FacesContext.getCurrentInstance(), ((ActionSource2)event.getComponent()).getActionExpression().getExpressionString(), outcome);
               }
              }
              


              Faces Config
              ...
               <application>
               <action-listener>
               actionList
               </action-listener>
              ...
              


              So I could say that all works jsut as you excpect..

              Seems - the problem is in your facelets 1.2 usage. We didn't tested it with RF because it isn't released.

              Could you please check with Facelets 1.1.14
              B.t.w. I'm using 3.2.0 snapshot. But it shouldn't infuence to result.

              • 4. Re: Tab-Panel and inner Forms submitted within a Tab
                Achim Grimm Newbie

                Hi ilya,

                After your reply, I had a view more tries this morning. At the beginning I could not recreat the problem. But after a view changes in the attributes, I came out with these to code snippes. With the first one, everything is working fine, the second one has the descriped behavour.

                First working version:
                JSF-Page:

                 <rich:tabPanel switchType="server" selectedTab="#{currentTabSession}">
                 <rich:tab label="test 1" action="TAB_A" id="TAB_A" >
                 <h:form>
                 <h:commandButton action="inputname" value="test" />
                 </h:form>
                 </rich:tab>
                 <rich:tab label="test 2" action="TAB_B" id="TAB_B" >
                 <h:outputText value="tab2"></h:outputText>
                 </rich:tab>
                </rich:tabPanel>
                


                Managed-Beans:
                ...
                <managed-bean>
                 <managed-bean-name>currentTabSession</managed-bean-name>
                 <managed-bean-class>java.lang.String</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                </managed-bean>
                ...
                



                Second not working version:
                JSF-Page:
                 <rich:tabPanel switchType="server" selectedTab="#{currentTab}">
                 <rich:tab label="test 1" action="TAB_A" id="TAB_A" >
                 <h:form>
                 <h:commandButton action="inputname" value="test" />
                 </h:form>
                 </rich:tab>
                 <rich:tab label="test 2" action="TAB_B" id="TAB_B" >
                 <h:outputText value="tab2"></h:outputText>
                 </rich:tab>
                </rich:tabPanel>
                


                Managed-Beans:
                ...
                <managed-bean>
                 <managed-bean-name>currentTabSession</managed-bean-name>
                 <managed-bean-class>java.lang.String</managed-bean-class>
                 <managed-bean-scope>none</managed-bean-scope>
                </managed-bean>
                ...
                


                The difference between those two version is the scope of the managed beans.

                Best regards.
                Achim Grimm