7 Replies Latest reply on Feb 28, 2012 4:48 AM by parthi ban

    RF4 CR1 - <rich:tabPanel> and activeItem... bug?

    Paweł Ryszawa Newbie

      Hi!

       

       

       

       

      Has anyone tried to use activeItem attribute in <rich:tabPanel>? I always get the following exception, no matter what the tab panel content is:

       

       

      java.lang.NullPointerException

       

          at org.richfaces.component.AbstractTabPanel.getActiveItem(AbstractTabPanel.java:64)

       

          at org.richfaces.component.AbstractTogglePanel.encodeBegin(AbstractTogglePanel.java:168)

       

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1611)

       

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

       

          at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:278)

       

          at org.richfaces.renderkit.html.PanelRenderer.encodeEnd(PanelRenderer.java:181)

       

          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)

       

          at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:295)

       

          at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:106)

       

          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

       

          at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:287)

       

          at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)

       

          at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)

       

          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

       

          at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:287)

       

          at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)

       

          at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)

       

          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

       

          at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:287)

       

          at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)

       

          at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)

       

          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

       

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

       

          at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

       

          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)

       

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)

       

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

       

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

       

          at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)

       

          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)

       

          at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)

       

          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)

       

          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

       

          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

       

          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)

       

          at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)

       

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

       

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)

       

          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)

       

          at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)

       

          at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)

       

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)

       

          at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)

       

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)

       

          at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)

       

          at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)

       

          at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)

       

          at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)

       

          at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)

       

          at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)

       

          at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)

       

          at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)

       

          at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)

       

          at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)

       

          at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)

       

          at com.sun.grizzly.ContextTask.run(ContextTask.java:69)

       

          at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)

       

          at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)

       

          at java.lang.Thread.run(Thread.java:619)

       

       

      Should I consider this a bug? Is there any workaround?

       

       

      After getting rid of the attribute, exception is not thrown. This way, however, I cannot control active tab form the code behind. Does anybody know another way to control actve tabs?

       

       

       

      Thanks in advance.

       

       

      Regards

        • 1. RF4 CR1 - <rich:tabPanel> and activeItem... bug?
          Ilya Shaikovsky Master

          activeItem used at richfaces-showcase for navigation tabPanel and I do not saw such problems neither before CR1 nor after the relase. so need more details like page and bean.

          • 2. RF4 CR1 - <rich:tabPanel> and activeItem... bug?
            Paweł Ryszawa Newbie

            The XHTML fragment is as follows:

             

                <rich:tabPanel id="tpaneWnplatProject" switchType="ajax" activeItem="#{managedBean.projActiveTab}">

                    <rich:tab id="wnplatProject1" header="1. #{msg['wnplat.project.title_tab1']}">

                        <f:subview id="svwWnplatProject1">

                            <ui:include src="project1.inc.xhtml" />

                        </f:subview>

                    </rich:tab>

                    <rich:tab id="wnplatProject2" header="2. #{msg['wnplat.project.title_tab2']}">

                        <f:subview id="svwWnplatProject2">

                            <ui:include src="project2.inc.xhtml" />

                        </f:subview>

                    </rich:tab>

                    <rich:tab id="wnplatProject3" header="3. #{msg['wnplat.project.title_tab3']}">

                        <f:subview id="svwWnplatProject3">

                            <ui:include src="project3.inc.xhtml" />

                        </f:subview>

                    </rich:tab>

                </rich:tabPanel>

             

             

            "managedBean" is @SessionScoped, of course, and has projActiveTabs property with getter and setter included. The issue is reproducible also for explicitly setting activeItem="0".

            • 3. RF4 CR1 - <rich:tabPanel> and activeItem... bug?
              Paweł Ryszawa Newbie

              Ok, I found it!

               

              activeItem must equal to one of the rich:tab's id... Mea culpa... I'm a newbie.

               

               

              Regards,

              • 4. Re: RF4 CR1 - <rich:tabPanel> and activeItem... bug?
                ahoehn Newbie

                hmm i have tried to set it to the tab-id, but the result was allways a nullpointerexception. Then I have changed it to the value of the name attribute of this tab. After that it was working... Just if others have the same issue

                 

                <rich:tabPanel switchType="ajax" id="contentTab" activeItem="myTabName2">

                <rich:tab id="myTabId1" name="myTabName1" />

                <rich:tab id="myTabId2" name="myTabName2" />

                </rich:tabPanel>

                • 5. Re: RF4 CR1 - <rich:tabPanel> and activeItem... bug?
                  parthi ban Newbie

                  Hi,

                   

                  I have been facing this problem when I dynamically add the rich tabs.

                   

                  ViewWageBean.java

                  private List<AggregateTypeBO> aggTypeCol = new ArrayList<AggregateTypeBO>();

                   

                  if(StringUtils.equals(search.getJurisdictionCode(), "NC")){

                                      return "payroll";

                                  }else{

                                      aggTypeCol = wageService.getAggregationTypeInfo(search.getRequestId(), search.getReplyId());

                                      setAggTypeCol(aggTypeCol);

                   

                  I have the setter/getters for this property.

                   

                  viewWage.xhtml

                  <rich:tabPanel id="tapPanel" activeItem="#{viewWageBean.currentTab}" switchType="ajax">

                          <a4j:repeat value="#{viewWageBean.aggTypeCol}" var="cap">

                                       <rich:tab name="#{cap.aggregateType}" actionListener="#{viewWageBean.selectTab}" id="#{cap.aggregateType}" >

                                             <h:outputText value="fun" />

                                       </rich:tab>

                             </a4j:repeat>

                  </rich:tabPanel>

                   

                  The bean is in Session Scope. I see this value #{viewWageBean.aggTypeCol} are available in setter/getters.

                   

                  public void selectTab(ActionEvent event){

                          setCurrentTab(event.getComponent().getId());

                      }

                   

                  Thru action listener I get the id of the tab and set it inactiveItem attribute but am facing the

                   

                    java.lang.IllegalArgumentException: Empty id attribute is not allowed

                   

                   

                   

                  Business Exception:  An unknown error occurred.

                  -------------------- STACK TRACE -----------------

                  73  calls in stack trace:

                      javax.faces.component.UIComponentBase.validateId(UIComponentBase.java:536)

                      javax.faces.component.UIComponentBase.setId(UIComponentBase.java:363)

                      com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.assignUniqueId(ComponentTagHandlerDelegateImpl.java:363)

                      com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:160)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)

                      org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:55)

                      com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)

                      org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:55)

                      com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)

                      javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)

                      org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:55)

                      com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)

                      com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:103)

                      com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178)

                      com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395)

                      com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366)

                      com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:108)

                      javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)

                      org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:55)

                      com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)

                      org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:55)

                      com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)

                      javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)

                      javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)

                      com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:164)

                      javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)

                      com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)

                      javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)

                      com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)

                      com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)

                      com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)

                      com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)

                      com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)

                      com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)

                      com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)

                      com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)

                      com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)

                      com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:769)

                      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)

                      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

                      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

                      javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)

                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                      com.lmig.cm.upswcs.servlet.filter.UpswcsSessionTimeoutFilter.doFilter(UpswcsSessionTimeoutFilter.java:77)

                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                      com.lmig.cm.common.web.utils.CMTimingFilter.doFilter(CMTimingFilter.java:98)

                      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)

                      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)

                      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

                      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)

                      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

                      org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)

                      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

                      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

                      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)

                      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)

                      org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)

                      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

                      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

                      java.lang.Thread.run(Thread.java:636)

                   

                  Could you please help me how to resolve this problem???

                  • 6. Re: RF4 CR1 - <rich:tabPanel> and activeItem... bug?
                    kevin 2 Newbie

                    Hi,

                     

                    You should use c:forEach instead of a4j:repeat, that's what I did and it works, except for tab removal.

                     

                    See explanation here: http://www.ninthavenue.com.au/blog/c:foreach-vs-ui:repeat-in-facelets

                     

                    If you want to help to resolve my issue, see my post https://community.jboss.org/thread/195685

                    • 7. Re: RF4 CR1 - <rich:tabPanel> and activeItem... bug?
                      parthi ban Newbie

                      Thanks Kevin...

                       

                      I have tried your idea but that too failed in my case... after a prolong effort, I just hard coded the tab panel with rendered attribute. If the attribute value is true then the specific tab will be displayed.

                       

                      <rich:tabPanel rendered="#{viewWageBean.isWeekly()}">

                                      <rich:tab name="Weekly" >

                                          <h:outputText value="in the weekly tab"></h:outputText>

                                          <ui:include src="/user/wage/weekly.xhtml"></ui:include>

                                       </rich:tab>

                      </rich:tabPanel>

                       

                      Finally this approach is quite easy to handle. Thanks Kevin and others.