4 Replies Latest reply on May 6, 2008 7:06 PM by Sergey Smirnov

    Dynamically created PanelMenu render problem

    Antonio Gurisatti Newbie

      Hi,

      Env: RichFaces 3.1.4, Jboss4.2.2, Mozilla Firefox

      Tag definition in page:

      <h:panelGrid id="menucat1" columns="1">
       <rich:panelMenu id="panmenu" binding="#{navegacionBean.panelMenu}">
       </rich:panelMenu>
       </h:panelGrid>
      


      Menú creation in backing bean:

       panelMenu.setMode("ajax");
       HtmlPanelMenuGroup pmg = new HtmlPanelMenuGroup();
       pmg.setLabel("Label 1");
       HtmlPanelMenuItem pmi = new HtmlPanelMenuItem();
       pmi.setLabel("Label 1.1");
       pmg.getChildren().add(pmi);
       pmi = new HtmlPanelMenuItem();
       pmi.setLabel("Label 1.2");
       pmg.getChildren().add(pmi);
      
       panelMenu.getChildren().add(pmg);
      
       pmg = new HtmlPanelMenuGroup();
       pmg.setLabel("Label 2");
       pmi = new HtmlPanelMenuItem();
       pmi.setLabel("Label 2.1");
       pmg.getChildren().add(pmi);
       pmi = new HtmlPanelMenuItem();
       pmi.setLabel("Label 2.2");
       pmg.getChildren().add(pmi);
      
       panelMenu.getChildren().add(pmg);
      


      Opening the page generates the following error:

      GRAVE: Error Rendering View[/paginas/navegacion/menu-catego.xhtml]
      java.lang.NullPointerException
       at org.richfaces.renderkit.html.PanelMenuGroupRenderer.isSelected(PanelMenuGroupRenderer.java:308)
       at org.richfaces.renderkit.html.PanelMenuGroupRenderer.getSelectedClass(PanelMenuGroupRenderer.java:246)
       at org.richfaces.renderkit.html.HtmlPanelMenuGroupRenderer.doEncodeBegin(HtmlPanelMenuGroupRenderer.java:112)
       at org.richfaces.renderkit.html.HtmlPanelMenuGroupRenderer.doEncodeBegin(HtmlPanelMenuGroupRenderer.java:86)
       at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
       at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:280)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
       at org.richfaces.renderkit.html.HtmlPanelMenuRenderer.doEncodeChildren(HtmlPanelMenuRenderer.java:224)
       at org.richfaces.renderkit.html.HtmlPanelMenuRenderer.doEncodeChildren(HtmlPanelMenuRenderer.java:219)
       at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271)
       at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
       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:179)
       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:595)
      



      I checked the dynamic generation of Drop Down Menu with success.

      I would apprecite very much any help on this, as I'm badly needing this component.

      Thanks a lot