7 Replies Latest reply on Aug 24, 2012 6:22 AM by Sergey Morenets

    rich:tabPanel doesn't work if switchType="ajax"

    Sergey Morenets Novice

      Hi, Guys

       

      I created a new topic instead of this https://community.jboss.org/message/755587

       

      If I use switchType "ajax" the tabs content is not updated.  Although the itemChangeListener works properly and makes server calls.

      For switchType "client" everything works fine.

      Please see below the a4j:log details. I clicked both tabs.

       

      debug[11:13:58.118]: New request added to queue. Queue requestGroupingId changed to myForm:j_idt494

      debug[11:13:58.119]: Queue will wait 0ms before submit

      debug[11:13:58.120]: richfaces.queue: will submit request NOW

      info [11:13:58.123]: Received 'begin' event from <div id=myForm:j_idt494 ...>

      info [11:13:58.212]: Received 'beforedomupdate' event from <div id=myForm:j_idt494 ...>

      debug[11:13:58.212]: Server returned responseText: <?xml version='1.0' encoding='UTF-8'?> <partial-response><changes><update id="javax.faces.ViewState"><![CDATA[e380s1]]></update></changes></partial-response>

      info [11:13:58.214]: Listing content of response changes element:

      Element update for id=javax.faces.ViewState

      <update id="javax.faces.ViewState"><![CDATA[e380s1]]></update>

      debug[11:13:58.214]: richfaces.queue: ajax submit successfull

      debug[11:13:58.215]: richfaces.queue: Nothing to submit

      info [11:13:58.216]: Received 'success' event from <div id=myForm:j_idt494 ...>

      info [11:13:58.217]: Received 'complete' event from <div id=myForm:j_idt494 ...>

      debug[11:14:02.101]: New request added to queue. Queue requestGroupingId changed to myForm:j_idt493

      debug[11:14:02.102]: Queue will wait 0ms before submit

      debug[11:14:02.102]: richfaces.queue: will submit request NOW

      info [11:14:02.104]: Received 'begin' event from <div id=myForm:j_idt493 class="rf-tab" ...>

      debug[11:14:02.111]: New request added to queue. Queue requestGroupingId changed to myForm:j_idt493

      debug[11:14:02.111]: Queue will wait 0ms before submit

      debug[11:14:02.112]: richfaces.queue: Waiting for previous submit results

      info [11:14:02.181]: Received 'beforedomupdate' event from <div id=myForm:j_idt493 class="rf-tab" ...>

      debug[11:14:02.182]: Server returned responseText: <?xml version='1.0' encoding='UTF-8'?> <partial-response><changes><update id="javax.faces.ViewState"><![CDATA[e380s1]]></update></changes></partial-response>

      info [11:14:02.183]: Listing content of response changes element:

      Element update for id=javax.faces.ViewState

      <update id="javax.faces.ViewState"><![CDATA[e380s1]]></update>

      debug[11:14:02.184]: richfaces.queue: ajax submit successfull

      debug[11:14:02.184]: richfaces.queue: will submit request NOW

      info [11:14:02.186]: Received 'success' event from <div id=myForm:j_idt493 class="rf-tab" ...>

      info [11:14:02.186]: Received 'complete' event from <div id=myForm:j_idt493 class="rf-tab" ...>

      info [11:14:02.187]: Received 'begin' event from <div id=myForm:j_idt493 class="rf-tab" ...>

      info [11:14:02.268]: Received 'beforedomupdate' event from <div id=myForm:j_idt493 class="rf-tab" ...>

      debug[11:14:02.268]: Server returned responseText: <?xml version='1.0' encoding='UTF-8'?> <partial-response><changes><update id="javax.faces.ViewState"><![CDATA[e380s1]]></update></changes></partial-response>

      info [11:14:02.270]: Listing content of response changes element:

      Element update for id=javax.faces.ViewState

      <update id="javax.faces.ViewState"><![CDATA[e380s1]]></update>

      debug[11:14:02.270]: richfaces.queue: ajax submit successfull

      debug[11:14:02.271]: richfaces.queue: Nothing to submit

      info [11:14:02.272]: Received 'success' event from <div id=myForm:j_idt493 class="rf-tab" ...>

      info [11:14:02.273]: Received 'complete' event from <div id=myForm:j_idt493 class="rf-tab" ...>

        • 1. Re: rich:tabPanel doesn't work if switchType="ajax"
          Sergey Morenets Novice

          I don't see any missing resources or console errors in the Firebug.

           

          Here is the code. Actually it is from Showcase demo.

           

          <h:body>

          <h:form>

          <rich:tabPanel switchType="ajax">

                  <rich:tab header="Overview">

                      RichFaces is a component library for JSF and an advanced framework for

                      easily integrating AJAX capabilities into business applications.

                  </rich:tab>

                  <rich:tab header="JSF 2 and RichFaces 4">

                      <p>We are working hard on RichFaces 4.0 which will have full JSF 2 integration. That is not all though, here is

                          a summary of updates and features:</p>

                  </rich:tab>

              </rich:tabPanel>

          </h:form>

          </h:body>

          • 2. Re: rich:tabPanel doesn't work if switchType="ajax"
            Sergey Morenets Novice

            I deployed your working sample from this ticket(Booking RichFaces demo) and added the code from the previous

            post. The tabs content is not updated.

             

            https://issues.jboss.org/browse/RFPL-1430

            https://issues.jboss.org/secure/attachment/12342821/booking-richfaces.zip

             

            RichFaces 4.2.2

            Mojarra 2.1.10

            Spring 3.1

            Spring Web Flow 2.3.1

            • 3. Re: rich:tabPanel doesn't work if switchType="ajax"
              Brendan Healey Master

              What about if you give each tab a name, rich:tab name="..." ? Not the greatest suggestion but all I can think of right now...

              • 4. Re: rich:tabPanel doesn't work if switchType="ajax"
                Brendan Healey Master

                Perhaps just try adding this in:

                 

                <h:head>

                    <h:outputScript library="javax.faces" name="jsf.js"/>

                </h:head>

                • 5. Re: rich:tabPanel doesn't work if switchType="ajax"
                  Sergey Morenets Novice

                  Thanks, Brendan.

                  I've applied both changes to Booking RichFaces demo but still without success ...

                   

                  What's more interesting is that a4j:log is a bit different in this case. Maybe it will help you.

                   

                  debug[12:23:00.776]: New request added to queue. Queue requestGroupingId changed to j_idt13:j_idt17

                   

                  debug[12:23:00.777]: Queue will wait 0ms before submit

                  debug[12:23:00.778]: richfaces.queue: will submit request NOW

                  info [12:23:00.780]: Received 'begin' event from <div id=j_idt13:j_idt17 ...>

                  info [12:23:00.794]: Received 'beforedomupdate' event from <div id=j_idt13:j_idt17 ...>

                  debug[12:23:00.796]: Server returned responseText: <?xml version='1.0' encoding='UTF-8'?> <partial-response><error><error-name>class java.io.FileNotFoundException</error-name><error-message><![CDATA[/WEB-INF/WEB-INF/intro.xhtml Not Found in ExternalContext as a Resource]]></error-message></error></partial-response>

                  info [12:23:00.798]: Element error
                  <error><error-name>class  java.io.FileNotFoundException</error-name><error-message><![CDATA[/WEB-INF/WEB-INF/intro.xhtml Not Found in ExternalContext as a Resource]]></error-message></error>

                  debug[12:23:00.800]: richfaces.queue: ajax submit error

                  debug[12:23:00.801]: richfaces.queue: Nothing to submit

                  error[12:23:00.802]: Received 'error@serverError' event from <div id=j_idt13:j_idt17 ...>

                  error[12:23:00.803]: [200] class java.io.FileNotFoundException: /WEB-INF/WEB-INF/intro.xhtml Not Found in ExternalContext as a Resource

                  info [12:23:00.804]: Received 'complete' event from <div id=j_idt13:j_idt17 ...>

                  • 6. Re: rich:tabPanel doesn't work if switchType="ajax"
                    Brendan Healey Master

                    too many WEB-INFs, is intro.xhtml the page with the tabPanel? what is your FacesServlet mapping data from web.xml?

                     

                    Edit: No input components inside the rich:tabs? how about rich:tab immediate="true"... Also from web.xml are you using

                    client or server state saving, full or partial?

                    • 7. Re: rich:tabPanel doesn't work if switchType="ajax"
                      Sergey Morenets Novice

                      After deep investigation I got the following results. The cause of the issue was the bean below in my config.

                       

                      <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
                      <property name="flowExecutor" ref="flowExecutor" />
                      </bean>

                       

                      However I coudn't get rid of it because I need to overwrite the default flow rules in Spring Web Flow.

                      Another investigation showed that this bean used Spring ajax handler by default. After I've added the following property to the bean

                      tabPanel starts working properly.

                       

                      <property name="ajaxHandler">
                      <bean class="org.springframework.faces.webflow.JsfAjaxHandler" />
                      </property>

                       

                      I assume it should be noted somewhere because I've never met this information explicitly. And in JSF 1.2/Spring 2.5/RF 3 it was not needed.