0 Replies Latest reply on Feb 27, 2008 11:45 AM by faithnomore79

    problem with HtmlPanelMenu when using backing bean

    faithnomore79

      Hi,

      I've just started using Richfaces. My first JSF application. I'm combining this with Facelets and JSF 1.2.

      I've buid panelMenu in this style:
      <rich:panelMenu binding="#{leftMenu.panelMenu}" mode="ajax"/>

      With a LeftMenu class looking something like this:

       private HtmlPanelMenu panelMenu;
      ...
       public HtmlPanelMenu getPanelMenu() {
       if (this.panelMenu == null) {
       this.panelMenu = new HtmlPanelMenu();
       this.fillMenu(this.panelMenu);
       }
       return this.panelMenu;
       }
      ....
      


      This worked good.

      Until I tried to add an actionListeren or ajaxListener:

      (inside the fillMenu() method..)
      
      panelMenuItem.addActionListener(new ActionListener() {
       public void processAction(final ActionEvent event) {
       System.out.println("processing");
       }});
      ..
      


      From the moment that this (or the addAjaxListener equivalent is added I constantly have the following exception:


      java.lang.IllegalStateException: com.foo.bar.LeftMenu$1
      at javax.faces.component.StateHolderSaver.restore(StateHolderSaver.java:98)
      at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1414)
      at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1276)
      at javax.faces.component.UICommand.restoreState(UICommand.java:332)
      at org.richfaces.component.html.HtmlPanelMenuItem.restoreState(HtmlPanelMenuItem.java:1426)
      at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1148)
      at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1164)
      at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1164)
      at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1164)
      at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1164)
      at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1164)
      at org.ajax4jsf.application.AjaxStateManager.restoreView(AjaxStateManager.java:246)
      at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:312)
      at com.sun.facelets.FaceletViewHandler.restoreView(FaceletViewHandler.java:316)
      at org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:116)
      at org.ajax4jsf.application.AjaxViewHandler.restoreView(AjaxViewHandler.java:159)
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:173)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:113)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:728)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:113)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:324)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:518)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:849)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:393)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:397)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)


      So... please help me... I don't really understand this exception and can't detect any other exceptions. Considering it works withouth adding a listener, this must be very specific. In the end I just want the same behaviour as the panelMenu on the demo application, except that the menuitems are retrieved from backend.

      Thanks for any help