1 2 Previous Next 21 Replies Latest reply on Mar 27, 2007 10:05 AM by jersinghaus

    rich:tabPanel + client + NullPointerException

    damianharvey

      I have tried to use a tabPanel with switchType set to Client in conjunction with a form that performs a database update. This generates the following error:

      java.lang.NullPointerException
      javax.faces.event.FacesEvent.queue(FacesEvent.java:54)
      org.richfaces.renderkit.TabPanelRendererBase.doDecode(TabPanelRendererBase.java:94)
      org.ajax4jsf.framework.renderer.RendererBase.decode(RendererBase.java:76)
      javax.faces.component.UIComponentBase.decode(UIComponentBase.java:500)
      javax.faces.component.UIInput.decode(UIInput.java:223)
      org.richfaces.component.UISwitchablePanel.processDecodes(UISwitchablePanel.java:158)
      javax.faces.component.UIForm.processDecodes(UIForm.java:53)
      javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:602)
      javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:135)
      org.ajax4jsf.framework.ajax.AjaxViewRoot.access$001(AjaxViewRoot.java:53)
      org.ajax4jsf.framework.ajax.AjaxViewRoot$1.invokeRoot(AjaxViewRoot.java:254)
      org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:54)
      etc etc.....
      


      If I change the switchType to Ajax or Server it works without problem.

      This is the basic form that I'm using to test this:
      <h:form>
      <rich:tabPanel switchType="client">
       <rich:tab label="Testy">
       <h:form id="region" styleClass="formInput">
       <label styleClass="propertyLabel" for="regionName">Name</label>
       <span class="inputSpan">
       <h:inputText id="regionName" value="#{regionHome.instance.regionName}"/>
       </span>
       <h:commandButton id="save" value="Save Entry" action="#{regionHome.persist}" rendered="#{!regionHome.managed}"/>
       </h:form>
       </rich:tab>
      </rich:tabPanel>
      </h:form>
      


      Cheers,

      Damian.

        • 1. Re: rich:tabPanel + client + NullPointerException

          you have a nested h:form. It is invalid combination.

          • 2. Re: rich:tabPanel + client + NullPointerException
            jersinghaus

            Hi Damian

            I'm brand new to richfaces (it looks really impressive) and this is almost the exact same code setup I used to test richfaces using myfaces/tomahawk 1.1.5.

            I don't have the nested h:form and if switchType="client", I get the same error you are getting. Set switchType="server" and my command button works.

            I hope that more than one person getting this type of error will aid in resolving the issue.


            Thanks,
            Joe


            • 3. Re: rich:tabPanel + client + NullPointerException
              jersinghaus

              Damian,

              I just tested the code using switchType="ajax" and that worked. I suspect if you remove the nested h:form it will work for you.

              The question that follows: is a switchType="client" with an embedded commandLink an invalid tabPanel configuration?


              Thanks,
              Joe

              • 4. Re: rich:tabPanel + client + NullPointerException

                The pure h:commandLink has a problem if it is re-rendered separate from the h:form. This problem does not relate to the tabPanel specifically anyhow.

                As I see, Damian has h:commandButton, not commandLink. So, it is not the same case.

                tabPanel does not required h:form around. (It creates the form dynamically around the tabs if it is missing)

                Does anybody also can confirm that switchType="client" has a problem in the situation when switchType="ajax" works fine? (it is not about nested forms. nested forms are invalid in any case)

                • 5. Re: rich:tabPanel + client + NullPointerException
                  michaelhaug

                  I can confirm the NullPointerException if switchType is set to "client". The following code works fine for switchType="ajax" or "server" but fails with a NullPointerException if set to "client":

                  <body>
                   <f:view>
                   <h:form>
                   <h:panelGroup>
                   <rich:tabPanel switchType="client">
                   <rich:tab label="Tab1">
                   <h:panelGroup>
                   <h:panelGrid columns="2">
                   <h:outputLabel rendered="true" value="#{msg.name}"></h:outputLabel>
                   <h:inputText tabindex="0" value="#{loginBean.name}"></h:inputText>
                   </h:panelGrid>
                   </h:panelGroup>
                   </rich:tab>
                   <rich:tab label="Tab2">
                   <h:panelGroup>
                   <h:panelGrid columns="2">
                   <h:outputLabel rendered="true" value="Alias"></h:outputLabel>
                   <h:inputText tabindex="1" value="#{loginBean.alias}"></h:inputText>
                   </h:panelGrid>
                   </h:panelGroup>
                   </rich:tab>
                   </rich:tabPanel>
                   <h:commandButton action="login" value="#{msg.login}"></h:commandButton>
                   </h:panelGroup>
                   </h:form>
                   </f:view>
                  </body>
                  
                  javax.servlet.ServletException
                   javax.faces.webapp.FacesServlet.service(FacesServlet.java:158)
                   org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                   org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                   org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
                  
                  root cause:
                  
                  java.lang.NullPointerException
                   javax.faces.event.FacesEvent.queue(FacesEvent.java:57)
                   org.richfaces.renderkit.TabPanelRendererBase.doDecode(TabPanelRendererBase.java:94)
                   org.ajax4jsf.framework.renderer.RendererBase.decode(RendererBase.java:76)
                   javax.faces.component.UIComponentBase.decode(UIComponentBase.java:503)
                   javax.faces.component.UIInput.decode(UIInput.java:224)
                   org.richfaces.component.UISwitchablePanel.processDecodes(UISwitchablePanel.java:158)
                   javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:605)
                   javax.faces.component.UIForm.processDecodes(UIForm.java:56)
                   javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:605)
                   javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:138)
                   org.ajax4jsf.framework.ajax.AjaxViewRoot.access$001(AjaxViewRoot.java:53)
                   org.ajax4jsf.framework.ajax.AjaxViewRoot$1.invokeRoot(AjaxViewRoot.java:254)
                   org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:54)
                   org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
                   org.ajax4jsf.framework.ajax.AjaxViewRoot.processDecodes(AjaxViewRoot.java:267)
                   org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
                   org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
                   org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
                   javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
                   org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                   org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                   org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
                  


                  kind regards,
                  Michael

                  • 6. Re: rich:tabPanel + client + NullPointerException

                    Thank you Michael. The issue has been added to JIRA:
                    http://jira.jboss.com/jira/browse/RF-26

                    • 7. Re: rich:tabPanel + client + NullPointerException

                      fixed today.

                      • 8. Re: rich:tabPanel + client + NullPointerException
                        jersinghaus

                        Hi Sergey,

                        This fix would be in the subversion repo correct?

                        Can you point me to some documentation on how to build from source?


                        Thanks,
                        Joe

                        • 9. Re: rich:tabPanel + client + NullPointerException

                          We build the SNAPSHOTs automatically each night.
                          http://jboss.com/index.html?module=bb&op=viewtopic&p=4029974#4029974

                          So, the easiest way is taking the ready-to-go jar files tomorrow morning.

                          To have your local build, you need to have a Maven installed.
                          Then, you need to checkout Ajax4jsf and RichFaces from the JBoss Svn.
                          Then the mvn install command on both repos does the job.

                          • 10. Re: rich:tabPanel + client + NullPointerException
                            jersinghaus

                            Hi Sergey,

                            Your quick response to questions is appreciated!

                            The fix worked but only for sun's RI (with a command link in a panelTab - see code below.)

                            If I use myfaces 1.1.5, I get this exception when the link is clicked:

                            javax.servlet.ServletException: FacesEvent of class org.richfaces.event.SwitchablePanelSwitchEvent not supported by UIInput
                             javax.faces.webapp.FacesServlet.service(FacesServlet.java:154)
                             org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                             org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                             org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
                             org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
                            
                            root cause
                            
                            java.lang.IllegalArgumentException: FacesEvent of class org.richfaces.event.SwitchablePanelSwitchEvent not supported by UIInput
                             javax.faces.component.UIInput.broadcast(UIInput.java:238)
                             org.richfaces.component.UISwitchablePanel.broadcast(UISwitchablePanel.java:130)
                            .
                            .
                            .
                            


                            This is the jsf code I'm using:
                             <f:view>
                             <h:form>
                             <h1><h:outputText value="Home" /></h1>
                             <rich:tabPanel switchType="client" width="40%" headerAlignment="left">
                             <rich:tab label="Canon">
                             <h:outputText value="empty" />
                             </rich:tab>
                             <rich:tab label="Nikon">
                             <h:commandLink action="home-page2" value="page 2"/>
                             </rich:tab>
                             <rich:tab label="Olympus">
                             <h:outputText value="empty" />
                             </rich:tab>
                             </rich:tabPanel>
                             </h:form>
                             </f:view>
                            


                            The initial page comes up OK. The tabPanel is there. If I click the link in the 2nd tab, that's when I get the exception.

                            If this helps, I'm using the following system:
                            Linux Ubuntu edgy
                            Java 1.5_08
                            Netbeans 5.5
                            Myfaces/Tomahawk 03/21 snapshot with their crazy web.xml file.

                            I'm using the basic 3 RichFaces web.xml entries: context-param, filter and filter-mapping as the documentation describes.


                            Thanks,
                            Joe



                            • 11. Re: rich:tabPanel + client + NullPointerException
                              nbelaevski

                              Thank you for reporting the problem, Joe!

                              I've created issue on that: http://jira.jboss.com/jira/browse/RF-30

                              • 12. Re: rich:tabPanel + client + NullPointerException
                                • 13. Re: rich:tabPanel + client + NullPointerException
                                  jersinghaus

                                  Gentlemen,

                                  Problem fixed!

                                  Not many open source much less commercial vendors offer this kind of response - Thank You!

                                  Now I have an interesting problem which may fall outside the RichFaces domain but I thought I'd bring it up anyway just in case others see this.

                                  I have placed a myfaces sandbox filter table (s:filterTable) control inside a tabPanel. You're probably already aware of this but the s:filterTable is a JSF wrapper around the dojo filter table.

                                  The control itself works great inside the tabPanel in that it communicates with my beans and gets populated with data in the accustomed JSF manner.

                                  But there are two problems that I have encountered:

                                  1. The dojo sort functionality is lost (header clicks do not sort the table) and,
                                  2. Only a partial segment of the css style associated with the filter table is applied. The header background images with the up/down arrows that show sort direction are missing.

                                  It would be great if you could make sandbox stuff work with RichFaces. I would be in heaven!


                                  Thanks for all your help thus far,
                                  Joe

                                  • 14. Re: rich:tabPanel + client + NullPointerException

                                    We have to have a test project where the problem exists to examine it. It might be so many configuration details that can hide the source

                                    1 2 Previous Next