8 Replies Latest reply on Jan 27, 2011 3:15 AM by ilya40umov

    Rich Tab Panel Whole Page gets refreshed...

    hereisrudro

      Hi

       

      I have added a RichTab Panel and there under the various rich:tabPanels I am including some pages using something like  <ui:include src="text.xhtml"?>.

      Now In that text.xhtml I am having some modalPanel which is displayed on the pressing of a button .Now whenever I press the button the rich:modalPanel opens and I select some value the whole page gets refreshed which should not be the case.

       

      Also suppose I am on the 3rd tab after refreshing it comes back to 1st tab.

      Can anyone thow some light on this???

        • 1. Rich Tab Panel Whole Page gets refreshed...
          ilya40umov

          Look at this:

          http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_tabPanel.html

          It says:

          Switching mode could be chosen with the tabPanel attribute "switchType" with three possible parameters.

          • server (DEFAULT)The common submission is performed around tabPanel and a page is completely rendered on a called panel. Only one at a time tabPanel is uploaded onto the client side.
          • ajaxAJAX form submission is performed around the tabPanel, content of the called tabPanel is uploaded on Ajax request. Only one at a time tabPanel is uploaded on the client.
          • clientAll tabPanels are uploaded on the client side. The switching from the active to the hidden panel is performed with client JavaScript.

           

          • 2. Rich Tab Panel Whole Page gets refreshed...
            hereisrudro

            Hi Ilya

             

            I went through the link .

             

            Now when I have switchType as server the page gets refreshed and always comes back to the first tab.I mean even when I click on other tabs it is only the first tab that I can see.

            When I change it to client there are no issues.

             

            But I want the switchtype to be server .

            Can you help me on this ?

            Do I explicitly write some code at the java end to like invoking some action to make this work??

            • 3. Rich Tab Panel Whole Page gets refreshed...
              ilya40umov

              1) Set switchType to server and put rich:messages onto the page.

              2) If it won't help you please provide some code which doesn't work properly.

              3) Do you mean that when you click on the second tab it shows you the firts tab again?

              • 4. Re: Rich Tab Panel Whole Page gets refreshed...
                hereisrudro

                Hi

                 

                <rich:tabPanel switchType="server"
                    style="position: absolute; right: 10px; left: 10px; width: 550px;margin-bottom: 10px;"
                    activeTabClass="navMenuLevel1-activeTab"
                    inactiveTabClass="navMenuLevel1-inactiveTab" tabClass="myTabClass"
                    id="topMenu" value="General" width="50%"
                    selectedTab="#{indexAction.tagSelected}">

                    <rich:tab label="#{messages['menu_n.page.General']}" name="General"
                     action="#{indexAction.loadGeneral}">
                     <ui:include src="/com/agcs/pv/schaden/web/general.xhtml" />
                    </rich:tab>

                    <rich:tab label="#{messages['menu_n.page.Actors']}" name="Actors"
                     action="#{indexAction.loadActors}">
                     <ui:include src="/com/agcs/pv/schaden/web/bearbeiter.xhtml" />
                    </rich:tab>

                    <rich:tab label="#{messages['menu_n.page.PolicyDescription']}"
                     name="PolicyDesc">
                     <ui:include src="/com/agcs/pv/schaden/web/vertrag.xhtml" />
                    </rich:tab>

                    <rich:tab label="#{messages['menu_n.page.Contact']}" name="Contact">
                     <ui:include src="/com/agcs/pv/schaden/web/kontake.xhtml" />
                    </rich:tab>
                </rich:tabPanel>

                 

                 

                yes u got it right

                when Iclick on the second tab it shows me the firts tab again.

                if u see I have used the selectedTab attribute  .I thought maybe  when I am clicking on the tab the action is not getting called and hence the same tab which is selected is getting shown.I removed it and checked but still same behaviour persistes.

                 

                Thanks Rudro

                • 5. Re: Rich Tab Panel Whole Page gets refreshed...
                  ilya40umov

                  1) Are your rich:tabPanel inside the form? It should be inside the form if you want to get switchType="server" working. Also make sure that yopu don't have nested forms.

                  2) Please could you replace all the ui:include inside your tabs with <h:outputText value="tab1"/>? Because I think that there could be a validation error when you switch between the tabs and it does allow rich:tabPanel to work.

                  P.S. Just in order to make everything clear. Have you added rich:messages on the page?

                   

                  From the documantation:

                  All tabPanels should be wrapped into a form element so as content is correctly submitted inside. If a form is placed into each tab, the Action elements of Tab controls appear to be out of the form and content submission inside the panels could be performed only for Action components inside tabs.
                  • 6. Re: Rich Tab Panel Whole Page gets refreshed...
                    hereisrudro

                    Hi Ilya

                     

                    1>Yes I have rich:tabPanel inside a form.

                     

                    2>This second point of yours I did not get.As u see I am including other pages under the tabs ,if I use h:outputText I wont be able to include the pages right?

                     

                    The pages which I include do contain h:form.

                     

                    I have not added rich:message , can u plz tell me how to use them effectively??

                    • 7. Re: Rich Tab Panel Whole Page gets refreshed...
                      hereisrudro

                      Hi Ilya

                       

                       

                      Just to test what u said. I  did this...

                       

                      <rich:tabPanel switchType="server"
                          style="position: absolute; right: 10px; left: 10px; width: 550px;margin-bottom: 10px;"
                          activeTabClass="navMenuLevel1-activeTab"
                          inactiveTabClass="navMenuLevel1-inactiveTab" tabClass="myTabClass"
                          id="topMenu" value="General" width="50%"
                          selectedTab="#{indexAction.tagSelected}">

                          <rich:tab label="#{messages['menu_n.page.General']}" name="General"
                           >
                           <h:outputText src="/com/agcs/pv/schaden/web/general.xhtml" />
                          </rich:tab>

                          <rich:tab label="#{messages['menu_n.page.Actors']}" name="Actors"
                           >
                           <ui:include src="/com/agcs/pv/schaden/web/bearbeiter.xhtml" />
                          </rich:tab>

                          <rich:tab label="#{messages['menu_n.page.PolicyDescription']}"
                           name="PolicyDesc">
                           <ui:include src="/com/agcs/pv/schaden/web/vertrag.xhtml" />
                          </rich:tab>

                          <rich:tab label="#{messages['menu_n.page.Contact']}" name="Contact">
                           <ui:include src="/com/agcs/pv/schaden/web/kontake.xhtml" />
                          </rich:tab>
                      </rich:tabPanel>

                       

                      Now the first tab is not coming but that is understood....rest all seems to work...

                       

                      Can u please explain??/

                      • 8. Re: Rich Tab Panel Whole Page gets refreshed...
                        ilya40umov

                        1) You definetly need to put rich:messages on your page. Look at this sample:

                        http://livedemo.exadel.com/richfaces-demo/richfaces/messages.jsf;jsessionid=C364D7F84AC0A6566567C81819AF3C58?c=messages&tab=usage

                        rich:messages is a very useful component which helps to defug validation problems.

                        2) I meant to put h:outputText inside your tabs instead of ui:include in order to DEBUG what's happening.

                        3) JSF does not support nested forms. So you can't have h:form inside another h:form. It's essential.

                        4) If you want to have forms inside each tab you should switchType="client". You can some additional workarounds to save state of rich:tabPanel.