ICEfaces
  1. ICEfaces
  2. ICE-2361

Dynamically created menu bar and menu items don't get action listener events.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7DR#2
    • Fix Version/s: 2.0.1, EE-1.8.2.GA_P03
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Facelets, JDK 1.5, tomcat 5.5
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial
    • Workaround Exists:
      Yes
    • Workaround Description:
      Basically, always use explicit ids with the MenuItem components you create with for ice:menuItems, and create them in your bean constructor, so that each call to the bean getter method will return the same components.

      Description

      MenuItems component renders as expected but it is not possible to use the action listener and likely the action attributes. The following stack trace occurs:

      SEVERE: Missing Form - the UIComponent of type [class com.icesoft.faces.component.menubar.MenuItem] requires a containing form.
      java.lang.NullPointerException: Missing Form - the UIComponent of type [class com.icesoft.faces.component.menubar.MenuItem] requires a containing form.
      at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.validateParameters(DomBasicRenderer.java:517)
      at com.icesoft.faces.component.menubar.MenuItemRenderer.decode(MenuItemRenderer.java:79)
      at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:685)
      at com.icesoft.faces.component.menubar.MenuItemBase.processDecodes(MenuItemBase.java:71)
      at com.icesoft.faces.component.menubar.MenuItemBase.decodeRecursive(MenuItemBase.java:88)
      at com.icesoft.faces.component.menubar.MenuItemBase.processDecodes(MenuItemBase.java:69)
      at com.icesoft.faces.component.menubar.MenuBar.decodeRecursive(MenuBar.java:269)
      at com.icesoft.faces.component.menubar.MenuBar.processDecodes(MenuBar.java:253)
      at javax.faces.component.UIForm.processDecodes(UIForm.java:164)
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:900)
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:900)
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:900)
      at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:326)
      at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:99)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
      at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:57)
      at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:45)
      at com.icesoft.faces.webapp.http.core.IDVerifier.service(IDVerifier.java:25)
      at com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:52)
      at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
      at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
      at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
      at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
      at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:117)
      at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
      at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
      at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
      at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:76)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:54)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
      at java.lang.Thread.run(Thread.java:613)

        Issue Links

          Activity

          Hide
          Patrick Corless added a comment -

          I'm taking a lot of heat on this one. Can you please take a look at this.

          Show
          Patrick Corless added a comment - I'm taking a lot of heat on this one. Can you please take a look at this.
          Hide
          Mark Collette added a comment -

          The solution is to build the MenuItem List in the bean constructor, not in the bean property getter method, since the menu code assumes that when it gets the lists multiples times, in a single render pass, that it's dealing with the same MenuItem objects.

          Show
          Mark Collette added a comment - The solution is to build the MenuItem List in the bean constructor, not in the bean property getter method, since the menu code assumes that when it gets the lists multiples times, in a single render pass, that it's dealing with the same MenuItem objects.
          Hide
          Michael Thiem added a comment -

          Can we comment this somewhere in the documentation or create an additional use case in the component showcase as best practice? Lot's of people are facing the same problem and wonder why this happens. It took me half a day to find out what's happening here.

          Show
          Michael Thiem added a comment - Can we comment this somewhere in the documentation or create an additional use case in the component showcase as best practice? Lot's of people are facing the same problem and wonder why this happens. It took me half a day to find out what's happening here.
          Hide
          yip.ng added a comment -

          TLD Doc and Javadoc updated.

          Revision: 24024


          Modified : /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/menubar/MenuItems.java
          Modified : /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-menunodes-props.xml

          Revision: 24025


          Modified : /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/menubar/MenuItems.java
          Modified : /icefaces2/trunk/icefaces/compat/component-metadata/src/main/resources/conf/ice_cust_properties/cust-menunodes-props.xml

          Show
          yip.ng added a comment - TLD Doc and Javadoc updated. Revision: 24024 Modified : /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/menubar/MenuItems.java Modified : /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-menunodes-props.xml Revision: 24025 Modified : /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/menubar/MenuItems.java Modified : /icefaces2/trunk/icefaces/compat/component-metadata/src/main/resources/conf/ice_cust_properties/cust-menunodes-props.xml
          Hide
          yip.ng added a comment -

          Example added to 1.8 showcase.

          Revision: 24032


          Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/bean/examples/component/menuBar/MenuBarBean.java
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_de.properties
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_en.properties
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_es.properties
          Added : /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/includes/examples/custom/menuBar2.jspx (Copy from path: /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/includes/examples/custom/menuBar.jspx, Revision, 24025)
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/facelets/web/WEB-INF/includes/content/navigation.jspx
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/facelets-enh/src/org/icefaces/application/showcase/view/jaxb/resources/application_structure.xml
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/jsp/web/WEB-INF/includes/content/navigation.jspx
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/jsp/web/showcase.jspx

          Show
          yip.ng added a comment - Example added to 1.8 showcase. Revision: 24032 Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/bean/examples/component/menuBar/MenuBarBean.java Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_de.properties Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_en.properties Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_es.properties Added : /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/includes/examples/custom/menuBar2.jspx (Copy from path: /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/includes/examples/custom/menuBar.jspx, Revision, 24025) Modified : /icefaces/trunk/icefaces/samples/component-showcase/facelets/web/WEB-INF/includes/content/navigation.jspx Modified : /icefaces/trunk/icefaces/samples/component-showcase/facelets-enh/src/org/icefaces/application/showcase/view/jaxb/resources/application_structure.xml Modified : /icefaces/trunk/icefaces/samples/component-showcase/jsp/web/WEB-INF/includes/content/navigation.jspx Modified : /icefaces/trunk/icefaces/samples/component-showcase/jsp/web/showcase.jspx
          Hide
          yip.ng added a comment -

          Example added to compat showcase.

          Revision: 24067


          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/java/org/icefaces/application/showcase/view/bean/examples/component/menuBar/MenuBarBean.java
          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_de.properties
          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_en.properties
          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_es.properties
          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/webapp/WEB-INF/includes/content/navigation.xhtml
          Added : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/webapp/WEB-INF/includes/examples/custom/menuBar2.xhtml (Copy from path: /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/webapp/WEB-INF/includes/examples/custom/menuBar.xhtml, Revision, 24051)

          Show
          yip.ng added a comment - Example added to compat showcase. Revision: 24067 Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/java/org/icefaces/application/showcase/view/bean/examples/component/menuBar/MenuBarBean.java Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_de.properties Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_en.properties Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_es.properties Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/webapp/WEB-INF/includes/content/navigation.xhtml Added : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/webapp/WEB-INF/includes/examples/custom/menuBar2.xhtml (Copy from path: /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/webapp/WEB-INF/includes/examples/custom/menuBar.xhtml, Revision, 24051)
          Hide
          yip.ng added a comment -

          Changed demo name to Dynamic Menu Bar.

          Revision: 24130


          Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_de.properties
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_en.properties
          Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_es.properties

          Revision: 24131


          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_de.properties
          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_en.properties
          Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_es.properties

          Show
          yip.ng added a comment - Changed demo name to Dynamic Menu Bar. Revision: 24130 Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_de.properties Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_en.properties Modified : /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_es.properties Revision: 24131 Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_de.properties Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_en.properties Modified : /icefaces2/trunk/icefaces/samples/compat/component-showcase/src/main/resources/org/icefaces/application/showcase/view/resources/messages_es.properties

            People

            • Assignee:
              yip.ng
              Reporter:
              Patrick Corless
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: