1 2 Previous Next 17 Replies Latest reply on May 4, 2009 6:40 PM by Nick Belaevski

    Problems with togglepanel

    Atul Kshirsagar Newbie

      Hi All,

      In our application we are using toggle panel to show/hide data tables. What we are seeing every now and then (not consistently reproducible) is that we get 'Facet not found' exception. I am not really sure what exactly is causing this issue. Below given is the code snippet:

      <rich:togglePanel switchType="client" stateOrder="open, closed">
       <f:facet name="closed">
       <h:panelGrid columns="1" border="0">
       <h:panelGrid columns="2" cellspacing="1" border="0">
       <rich:toggleControl switchToState="open">
       <!-- we are actually using h:graphicImage here but for sake of simplicity I am putting outputText here -->
       <h:outputText value="+" />
       </rich:toggleControl>
       <h:outputText value="Summary" />
       </h:panelGrid>
       </h:panelGrid>
       </f:facet>
       <f:facet name="open">
       <h:panelGrid columns="1" border="0">
       <h:panelGrid columns="2" cellspacing="1" border="0">
       <rich:toggleControl switchToState="closed">
       <h:outputText value="-" />
       </rich:toggleControl>
       <h:outputText value="Summary" />
       </h:panelGrid>
       </h:panelGrid>
       <!-- multiple data tables showing some data -->
       ...
       ...
       </f:facet>
      </rich:togglePanel>
      
      <rich:panel id="dataList">
       <a4j:repeat value="#{myBean.data}" var="d">
       <rich:spacer height="5" />
       <rich:togglePanel switchType="client" stateOrder="open, closed">
       <f:facet name="closed">
       <h:panelGrid columns="1" border="0">
       <rich:toggleControl switchToState="open">
       <h:outputText value="+" />
       </rich:toggleControl>
       <h:outputText value="#{d.name}" />
       <!-- data table showing summarized data -->
       ...
       ...
       </h:panelGrid>
       </f:facet>
       <f:facet name="open">
       <h:panelGrid columns="1" border="0">
       <rich:toggleControl switchToState="closed">
       <h:outputText value="-" />
       </rich:toggleControl>
       <h:outputText value="#{d.name}" />
       <!-- some more data tables showing detailed data -->
       ...
       ...
       ...
       </h:panelGrid>
       </f:facet>
       </rich:togglePanel>
       </a4j:repeat>
      </rich:panel>


      With this code I run in to following exception:

      javax.faces.FacesException: Facet with name: closed not found!
      at org.richfaces.renderkit.html.TogglePanelRenderer.getFacet(TogglePanelRenderer.java:73)
      at org.richfaces.renderkit.html.TogglePanelRenderer.handleFacets(TogglePanelRenderer.java:108)
      at org.richfaces.renderkit.html.TogglePanelTemplate.doEncodeEnd(TogglePanelTemplate.java:146)
      at org.richfaces.renderkit.html.TogglePanelTemplate.doEncodeEnd(TogglePanelTemplate.java:154)
      at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286)
      at org.ajax4jsf.renderkit.html.RepeatRenderer$1.process(RepeatRenderer.java:53)
      at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:101)
      at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1151)
      at org.ajax4jsf.renderkit.html.RepeatRenderer.encodeChildren(RepeatRenderer.java:59)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:220)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:215)
      at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:234)
      at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:178)
      at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:126)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.TabRendererBase.encodeChildren(TabRendererBase.java:113)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:285)
      at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:280)
      at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:124)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
      at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
      at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:677)
      at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:548)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      at java.lang.Thread.run(Thread.java:619)


      Is togglepanel within a4j:repeat causing this problem? Or is it something else?

      My environment is as follows:
      JBoss AS: 4.2.3 GA
      JBoss Seam: 2.1.1 GA
      JBoss RichFaces:3.3.0 GA

      Any help/pointers are highly appreciated.

      Thanks,
      Atul

        • 1. Re: Problems with togglepanel
          Nick Belaevski Master

          Hello Atul,

          Is f:* prefix correctly defined on the page:

          xmlns:f="http://java.sun.com/jsf/core"
          ?

          • 2. Re: Problems with togglepanel
            Atul Kshirsagar Newbie

            Yes, I "f:" prefix is defined on the page. Here is the prefix definitions used on the page:

            xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich"



            --Atul

            • 3. Re: Problems with togglepanel
              Nick Belaevski Master

              This:

              <f:facet name="open">
               <h:panelGrid columns="1" border="0">
               <h:panelGrid columns="2" cellspacing="1" border="0">
               <rich:toggleControl switchToState="closed">
               <h:outputText value="-" />
               </rich:toggleControl>
               <h:outputText value="Summary" />
               </h:panelGrid>
               </h:panelGrid>
               <!-- multiple data tables showing some data -->
               ...
               ...
               </f:facet>
              may be the reason. f:facet tag must contain single child only.

              • 4. Re: Problems with togglepanel
                Atul Kshirsagar Newbie

                I am sorry, I put the comment outside the panelGrid. f:facet does have only child. Below given is the updated code:

                <f:facet name="open">
                 <h:panelGrid columns="1" border="0">
                 <h:panelGrid columns="2" cellspacing="1" border="0">
                 <rich:toggleControl switchToState="closed">
                 <h:outputText value="-" />
                 </rich:toggleControl>
                 <h:outputText value="Summary" />
                 </h:panelGrid>
                 <!-- multiple data tables showing some data -->
                 ...
                 ...
                
                 </h:panelGrid>
                 </f:facet>


                Also, as I had indicated earlier the problem is not consistent. It happens intermittently, no known way of reproducing it.

                --Atul

                • 5. Re: Problems with togglepanel
                  Nick Belaevski Master

                  Can you please post web.xml file and content surrounding toggle panels?

                  • 6. Re: Problems with togglepanel
                    Atul Kshirsagar Newbie

                    Here's the web.xml:

                    <?xml version="1.0" ?>
                    <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">
                    
                     <!-- Ajax4jsf -->
                    
                     <context-param>
                     <param-name>org.richfaces.SKIN</param-name>
                     <param-value>DEFAULT</param-value>
                     </context-param>
                    
                     <!-- Seam -->
                    
                     <listener>
                     <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                     </listener>
                    
                     <filter>
                     <filter-name>Seam Filter</filter-name>
                     <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
                     <!-- FileUpload Filters -->
                     <init-param>
                     <param-name>createTempFiles</param-name>
                     <param-value>false</param-value>
                     </init-param>
                     <init-param>
                     <param-name>maxRequestSize</param-name>
                     <param-value>1000000</param-value>
                     </init-param>
                    
                     </filter>
                    
                     <filter-mapping>
                     <filter-name>Seam Filter</filter-name>
                     <url-pattern>/*</url-pattern>
                     </filter-mapping>
                    
                     <servlet>
                     <servlet-name>Seam Resource Servlet</servlet-name>
                     <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
                     </servlet>
                    
                     <servlet-mapping>
                     <servlet-name>Seam Resource Servlet</servlet-name>
                     <url-pattern>/seam/resource/*</url-pattern>
                     </servlet-mapping>
                    
                     <!-- Facelets development mode (disable in production) -->
                    
                     <context-param>
                     <param-name>facelets.DEVELOPMENT</param-name>
                     <param-value>true</param-value>
                     </context-param>
                    
                     <!-- JSF -->
                    
                     <context-param>
                     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                     <param-value>.xhtml</param-value>
                     </context-param>
                    
                     <context-param>
                     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                     <param-value>server</param-value>
                     </context-param>
                    
                     <context-param>
                     <param-name>javax.faces.CONFIG_FILES</param-name>
                     <param-value>/WEB-INF/faces-config.xml</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>*.seam</url-pattern>
                     </servlet-mapping>
                    
                     <security-constraint>
                     <display-name>Restrict raw XHTML Documents</display-name>
                     <web-resource-collection>
                     <web-resource-name>XHTML</web-resource-name>
                     <url-pattern>*.xhtml</url-pattern>
                     </web-resource-collection>
                     <auth-constraint/>
                     </security-constraint>
                    
                     <context-param>
                     <param-name>facelets.LIBRARIES</param-name>
                     <param-value>/WEB-INF/brcd-widget.taglib.xml</param-value>
                     </context-param>
                    
                     </web-app>


                    The code surrounding the toggle panels is as follows:

                    
                    <rich:modalPanel>
                    <!-- some configuration stuff goes here -->
                    </rich:modalPanel>
                    <!-- multiple such modal panels -->
                    ..
                    ..
                    ..
                    <h:form id="menuForm">
                    <!-- tool bar for the application -->
                    <rich:toolBar>
                    </rich:toolBar>
                    
                    </h:form>
                    
                    <h:form id="mainForm">
                    <a4j:queue name="myEventQueue"/>
                    <!-- a4j push that re-renders the data tables inside toggle panel in tab one-->
                    <a4j:push eventsQueue="myEventQueue" reRender="oneOfTheTableInTogglePanel" eventProducer="#{myBean.addListener}" interval="10000"
                    ignoreDupResponses="true" action="#{myBean.populateViewModel}" limitToList="true"/>
                    ...
                    ...
                    ..
                    <!-- multiple such a4j push to re-render different tables in tab one -->
                    
                    <rich:tabPanel id="tabs" selectedTab="#{viewManager.selectedTab}" switchType="ajax" >
                    <rich:tab name="one" rendered="true">
                     <f:facet name="label">
                     <h:outputText value="One" />
                     </f:facet>
                    <!-- ALL TOGGLE PANELS IN EARLIER POST GO HERE -->
                    </rich:tab>
                    
                    <rich:tab name="Two" rendered="#{viewManager.secondTabRendered}">
                     <f:facet name="label">
                     <h:outputText value="Two" />
                     </f:facet>
                    <!-- SOME MORE TOGGLE PANELS WITH SAME FACET NAMES (OPEN AND CLOSED) GO HERE -->
                    </rich:tab>
                    ...
                    ...
                    ...
                    <!-- multiple such tabs that have more toggle panels again with same facet names -->
                    </rich:tabPanel>
                    </h:form>
                    





                    • 7. Re: Problems with togglepanel
                      Nick Belaevski Master

                      Can you please try replacing f:facet with a4j:facet? Also are you using the latest Facelets version available?

                      • 8. Re: Problems with togglepanel
                        Atul Kshirsagar Newbie

                        I am using facelets version that comes with JBoss Seam. For 2.1.1GA Seam version I checked that Facelets version 1.1.15.B1 is being used.

                        Let me try changing the f:facets to a4j:facets and see if I can reproduce the issue.

                        Thanks,
                        Atul

                        • 9. Re: Problems with togglepanel
                          Atul Kshirsagar Newbie

                          No luck! Even with a4j:facet I am hitting this issue. Is there any limit on number of togglepanels (with same facet names) that can be used on a single page?

                          I am now trying by having unique facet names in each togglepanel that I am using.

                          --Atul

                          • 10. Re: Problems with togglepanel
                            Nick Belaevski Master

                            There should be no limit. BTW, does the problem reproduce for client-side method state saving?

                            • 11. Re: Problems with togglepanel
                              nimo stephan Master

                              Try to wrap all the content to a4j:outputPanel !

                              <f:facet name="open">
                              <a4j:outputPanel>
                               nested childs..
                              
                              </a4j:outputPanel>
                              </f:facet name="open">


                              then it should work!




                              • 12. Re: Problems with togglepanel
                                nimo stephan Master

                                by the way, I cannot see any documentation for a4j:facet (is this a secret tag?)

                                • 13. Re: Problems with togglepanel
                                  Nick Belaevski Master

                                  That's because documentation is built around TLD files and a4j:facet is a Facelets-only tag.

                                  • 14. Re: Problems with togglepanel
                                    Atul Kshirsagar Newbie

                                    I will try both (Client side state saving and a4j:outputPanel) and post my results.

                                    --Atul

                                    1 2 Previous Next