5 Replies Latest reply on Apr 4, 2014 2:42 AM by ppitonak

    tabPanel won't switch tabs

    vladodias

      Hi all,

       

      I have a very simple project where I'm trying to use RichFaces on Weblogic 10.3.6...

       

      Most of the components work ok, but I have a tabPanel and the switch between tabs just doesn't work, the mouse changes to a hand when I hover over the header of the tab#2, but nothing happens when I click on it... I couldn't find anything in the server logs also...

       

      Hope somebody here can give me any insights... Here's my code

       

      <!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:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
      
      <ui:composition>
          <h:head/>
          <rich:tabPanel switchType="client">
              <rich:tab header="tab#1">
                  tab#1
              </rich:tab>
              <rich:tab header="tab#2">
                  tab#2
              </rich:tab>
          </rich:tabPanel>
      
      </ui:composition>
      </html>
      

       

      <?xml version = '1.0' encoding = 'windows-1252'?>
      <web-app 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-app_2_5.xsd"
               version="2.5">
      
      
        <context-param>
          <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
          <param-value>*.jsf;*.xhtml</param-value>
        </context-param>
        <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
      
      
          <context-param>
              <param-name>org.richfaces.skin</param-name>
              <param-value>blueSky</param-value>
          </context-param>
          
      </web-app>
      
      
      
      
      
      
      
      
      

       

      Cheers,

      Vlad

        • 1. Re: tabPanel won't switch tabs
          ppitonak

          Hi,

           

          please try to set "id" and/or "name" attributes of rich:tab like this:

           

          <rich:tabPanel switchType="client">  
              <rich:tab id="tab1" name="tab1" header="tab#1">  
                  tab#1  
              </rich:tab>  
              <rich:tab id="tab2" name="tab2" header="tab#2">  
                  tab#2  
              </rich:tab>  
          </rich:tabPanel>  
          

           

          Regards,

          Pavol

          1 of 1 people found this helpful
          • 2. Re: tabPanel won't switch tabs
            vladodias

            Hi Pavol,

             

            Thanks for replying, but that made no difference... I tried with name+id, name only and id only, but all have the same behaviour...

             

            I've notice that if I go on chrome and do inspect element on tab#2 the "Event Listeners" part says "No event listeners"... But if I do the same on the tab sample in showcase.richfaces.org it shows the listeners there...

             

            Any clues on why it is not loading the listeners in my case?

             

            Cheers,

            Vlad

            • 3. Re: Re: tabPanel won't switch tabs
              ppitonak

              Hi,

               

              I didn't realize that you are using ui:composition in a wrong way. This should work:

               

              <!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:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
                  <h:head />
                  <h:body>
                      <rich:tabPanel switchType="client">
                          <rich:tab header="tab#1">tab#1</rich:tab>
                          <rich:tab header="tab#2">tab#2</rich:tab>
                      </rich:tabPanel>
                  </h:body>
              </html>
              

               

              You can find more info in the Java EE 6 Tutorial (http://docs.oracle.com/javaee/6/tutorial/doc/giqxp.html).

               

              Regards,

              Pavol

              • 4. Re: Re: tabPanel won't switch tabs
                vladodias

                Thanks mate! That did the trick... You are the man!

                 

                As an inexperienced user of RichFaces, I find it very difficult to adapt code that I see in the showcase to my reality...

                 

                My code came from the showcase, link bellow... Firstly, I just copied and pasted the source into a new page, it doesn't work at all, as many of the showcase examples, it lacks the <h:head>, so it won't load the styles... Also, the ui:composition is there, and it works with it... so I would never imagine it shouldn't be there...

                http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=tabPanel&skin=blueSky

                 

                I haven't find anywhere in RichFaces documentation anything saying <h:head/> is needed... Or where/how to use ui:composition... Documentation is in fact pretty good, but in my opinion it lacks a more beginner oriented getting started section... I guess the mix between JSF2 tags and RichFaces tags gets people confused, it would be good if they could clarify on what goes along with what and where things should go...

                 

                Thanks again!

                 

                Cheers,

                Vlad

                • 5. Re: Re: tabPanel won't switch tabs
                  ppitonak

                  I'm glad it works now Thanks for your valuable feedback.