3 Replies Latest reply on Mar 20, 2009 2:16 PM by vsirishreddy

    Problem with rich:tabPanel component

    vsirishreddy

      I have a problem with embedded rich:tabPanel component.

      Let me put it this way:

      I have a tabbed pane with 3 tabs designed using <rich:tabPanel>. Inside TAB 3 I have another tabbed pane with 10 tabs. The switchType attribute for both the tabbed panes is 'ajax', similar result when tried with 'client' too.

      Problem here being, when I submit the form from TAB 3, it submits the form and refreshes the page, but it doesn't go to my action class. Tried the same without the embedded tabbed pane in TAB 3, and it hits my action class. I don't see any validation errors, as my phase listener tells me that all the 6 phases are executed.

      I am using Sun's Mojarra 1.2_12, richfaces-api-3.3.0.GA.jar.

      Any hint on this issue would be highly appreciated.

      Thanks.

        • 1. Re: Problem with rich:tabPanel component
          nbelaevski

           

          "vsirishreddy" wrote:
          but it doesn't go to my action class

          What is your action class and how do you use it?

          • 2. Re: Problem with rich:tabPanel component
            vsirishreddy

            This is how my code looks like:

            My JSP:

            <f:subview id="billsearch">
            <html>
            <body>
            <h:form id="billSearchForm" onkeypress ="if (event.keyCode == 13) {submitForm(); return false;}; return true;">
             <t:messages layout="list" styleClass="errorStyle" />
             <rich:tabPanel switchType="ajax" activeTabClass="activeTabRich" inactiveTabClass="inactiveTabRich"
             headerAlignment="left" contentClass="tabContentRich" headerSpacing="2px"
             styleClass="myClass">
            <%-- simple search tab --%>
             <rich:tab id="simpleSearch" styleClass="myClass" label="Search" onkeypress="setSimpleFlag();" onclick="setSimpleFlag();">
            <%-- some content goes here --%>
             </rich:tab>
            
            <%-- lucene text search taqb --%>
             <rich:tab id="advanceSearch" styleClass="myClass" label="Text Search" onkeypress="setSimpleTextFlag();" onclick="setSimpleTextFlag();">
            <%-- some content goes here --%>
             </rich:tab>
            
            <%-- advance query search tab --%>
             <rich:tab id="completeAdvancedSearch" styleClass="myClass" label="Advanced Search">
            
             <rich:tabPanel switchType="client" activeTabClass="activeSubTabRich"
             inactiveTabClass="inactiveSubTabRich" headerAlignment="left"
             contentClass="subTabContentRich" headerSpacing="2px">
            
             <%-- HOME TAB --%>
             <rich:tab id="homeTab" label="#{bundle['lis.adv.search.tab.home']}">
             <h:panelGroup>
             <jsp:include page="AdvanceSearch/tabHome.jsp" />
             </h:panelGroup>
             </rich:tab>
            
             <%-- AUTHOR TAB --%>
             <rich:tab id="authorsTab" label="#{bundle['lis.adv.search.tab.author']}"
             ontableave="executeOnSubmit('authorTab');">
             <h:panelGroup>
             <jsp:include page="AdvanceSearch/tabAuthor.jsp" />
             </h:panelGroup>
             </rich:tab>
            
             <%-- FLAGS TAB --%>
             <rich:tab id="flagsTab" label="#{bundle['lis.adv.search.tab.flags']}">
             <h:panelGroup>
             <jsp:include page="AdvanceSearch/tabFlags.jsp" />
             </h:panelGroup>
             </rich:tab>
            
             <%-- VOTES TAB --%>
             <rich:tab id="votesTab" label="#{bundle['lis.adv.search.tab.votes']}"
             ontableave="executeOnSubmit('voteTab');">
             <h:panelGroup>
             <jsp:include page="AdvanceSearch/tabVotes.jsp" />
             </h:panelGroup>
             </rich:tab>
            
             <%-- CODES TAB --%>
             <rich:tab id="codesTab" label="#{bundle['lis.adv.search.tab.codes']}">
             <h:panelGroup>
             <jsp:include page="AdvanceSearch/tabCodes.jsp" />
             </h:panelGroup>
             </rich:tab>
            
            
            //PROBLEM WITH THE BELOW ACTION BUTTONS. NOT GOING TO ACTION METHOD WHEN SUBMITTED
            
             <h:panelGrid width="100%" columns="1" style="text-align: center">
             <h:panelGroup>
             <t:commandButton id="advSearch" value="#{bundle['submit_search']}" action="#{advanceSearchProcess.executeSearch}" styleClass="buttons"/>
             <h:outputText value=" "/>
             <t:commandButton value="#{bundle.clear}" onclick="clearAdvanceSearch();" action="#{advanceSearchProcess.clearAll}" styleClass="buttons"/>
             </h:panelGroup>
             </h:panelGrid>
             </rich:tabPanel>
             </rich:tab>
            
             </rich:tabPanel>
            </h:form>
            </body>
            </html>
            </f:subview>


            My Action Method:

            public String executeSearch(){
             Utility.Log(Level.INFO, this, "ENTER executeSearch");
             String outCome = "showadvancebills";
             StringBuffer query = null;
             try {
             query = prepareQuery();
             if (query != null) {
             outCome = executeSearchQuery(query.toString());
             } else {
             return null;
             }
             } catch (Exception ex) {
             ex.printStackTrace();
             }
             Utility.Log(Level.INFO, this, "EXIT executeSearch");
             return outCome;
            }


            The buttons in the third tab are not directing me to the action class in my Invoke Application Phase. Any hint on possible code changes to solve this issue would be highly appreciated.

            Thanks.

            • 3. Re: Problem with rich:tabPanel component
              vsirishreddy

              If I make the following change in the code, then it seems to work. I have to move my command button into the tab from the tabPanel.

              ... ... ... ... ... ... ... ... ... ... ... ... ...
              ... ... ... ... ... ... ... ... ... ... ... ... ...
              
              <%-- VOTES TAB --%>
               <rich:tab id="votesTab" label="#{bundle['lis.adv.search.tab.votes']}"
               ontableave="executeOnSubmit('voteTab');">
               <h:panelGroup>
               <jsp:include page="AdvanceSearch/tabVotes.jsp" />
               </h:panelGroup>
              //Placing the buttons inside the tab works
               <h:panelGroup>
               <t:commandButton id="advSearch" value="#{bundle['submit_search']}" action="#{advanceSearchProcess.executeSearch}" styleClass="buttons"/>
               <h:outputText value=" "/>
               <t:commandButton value="#{bundle.clear}" onclick="clearAdvanceSearch();" action="#{advanceSearchProcess.clearAll}" styleClass="buttons"/>
               </h:panelGroup>
               </rich:tab>
              
              <%-- CODES TAB --%>
               <rich:tab id="codesTab" label="#{bundle['lis.adv.search.tab.codes']}">
               <h:panelGroup>
               <jsp:include page="AdvanceSearch/tabCodes.jsp" />
               </h:panelGroup>
              //Placing the buttons inside the tab works
               <h:panelGroup>
               <t:commandButton id="advSearch" value="#{bundle['submit_search']}" action="#{advanceSearchProcess.executeSearch}" styleClass="buttons"/>
               <h:outputText value=" "/>
               <t:commandButton value="#{bundle.clear}" onclick="clearAdvanceSearch();" action="#{advanceSearchProcess.clearAll}" styleClass="buttons"/>
               </h:panelGroup>
               </rich:tab>
              ... ... ... ... ... ... ... ... ... ... ... ... ...
              ... ... ... ... ... ... ... ... ... ... ... ... ...


              I don't want to define the same button multiple times inside each tab, might have to do if there is no other way.

              Is this a bug or is this the way it is supposed to work? But as an end user I definitely expect my command button to work the way it has to, irrespective of where I place it. Any comments and alternate solutions are welcome.

              Thanks.