9 Replies Latest reply on Dec 22, 2006 9:30 AM by davidalves

    Seam And ICEFaces menubar

    davidalves

      Hi I'm trying to build a menu using a Seam action as a backing bean for ICEFaces menuBar component.

      I goes something like this:

      MainMenuAction

      @Stateless
      @Name("mainMenuAction")
      @Scope(ScopeType.SESSION)
      public class MainMenuAction implements MainMenu {
      
       @In(required = true)
       User user;
      
       @Logger
       Log log;
      
       @Out
       public List<MenuItem> mainMenu;
      
       public String getMainMenu() {
      
       mainMenu = new ArrayList<MenuItem>();
       MenuItem mainClassifieds = new MenuItem();
       mainClassifieds.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
       mainClassifieds.setValue("Opt1");
      
       MenuItem searchClassified = new MenuItem();
       searchClassified.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
       searchClassified.setValue("Op2");
      
       MenuItem addClassified = new MenuItem();
       addClassified.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
       addClassified.setValue("Op3");
      
       mainClassifieds.getChildren().add(searchClassified);
       mainClassifieds.getChildren().add(addClassified);
      
       MenuItem myClassifieds = new MenuItem();
       myClassifieds.setIcon("xmlhttp/css/xp/css-images/menuitem.gif");
       myClassifieds.setValue("Opt4");
      
       mainMenu.add(mainClassifieds);
       mainMenu.add(myClassifieds);
      
       return null;
       }
      }
      


      mainMenuPanel.xhtml

      
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:ice="http://www.icesoft.com/icefaces/component">
      <body>
      <h:form>
       <ice:menuBar orientation="vertical" >
       <ice:menuItems value="#{mainMenuAction.mainMenu}"/>
       </ice:menuBar>
      </h:form>
      </body>
      </html>
      
      


      I'm getting the following exception:

      01:27:11,548 ERROR [D2DFaceletViewHandler] Problem in renderResponse: /main/mainMenuPanel.xhtml @9,63 value="#{mainMenuAction.getMainMenu}": Bean: org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$1503199b, property: getMainMenu
      javax.faces.el.PropertyNotFoundException: /main/mainMenuPanel.xhtml @9,63 value="#{mainMenuAction.getMainMenu}": Bean: org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$1503199b, property: getMainMenu
       at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
       at com.icesoft.faces.component.menubar.MenuItems.getValue(MenuItems.java:82)
       at com.icesoft.faces.component.menubar.MenuItemsRenderer.encodeChildren(MenuItemsRenderer.java:54)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
      


      I just started integrating ICEFaces with Seam so if this is an extremely n00b question I apologize in advance, butI've tryed a lot of variations.

        • 1. Re: Seam And ICEFaces menubar
          jdestef

          Did you declare public String getMainMenu() in your MainMenu interface?

          • 2. Re: Seam And ICEFaces menubar
            davidalves

            Any interface method is implicitly public, but yes I did explicitly declare the method as public.

            • 3. Re: Seam And ICEFaces menubar
              davidalves

              (maybe I understood the quetion wrong)
              Yes I declared an interface (marked it with the @Local annotation) and declared the method public String getMainMenu().

              • 4. Re: Seam And ICEFaces menubar

                It pretty much looks like a class loading / caching issue to me. I am fighting with these kind of problems so often...

                just a cheap advice : triple check all your class folders and clean everything before rebuild...

                :)

                • 5. Re: Seam And ICEFaces menubar
                  davidalves

                  Hi, I've tryied a lot of combinations (method names etc) a still no luck.
                  I allways clean everithing before rebuild (my ant script does that when i select the deploy target)

                  So... any suggestions?

                  • 6. Re: Seam And ICEFaces menubar
                    davidalves

                    btw, there is an error in my xhtml page the EJB call is actually mainMenu.getMainMenu (that was only one of the other things I tryed)

                    • 7. Re: Seam And ICEFaces menubar
                      davidalves

                      no ideas??

                      • 8. Re: Seam And ICEFaces menubar

                        Perhaps you should return something? And not null. Or you change the scope to APPLICATION?

                        Here's my menu bean:

                        @Stateless
                        @Name("sideNavigationMenu")
                        @Scope(ScopeType.APPLICATION)
                        public class SideNavigationMenu implements SideNavigation {
                         @In
                         private FacesContext facesContext;
                        
                         @In @Valid
                         private User user;
                        
                         public List<MenuItem> getPanelNavigationItems() {
                         List<MenuItem> menu = new ArrayList<MenuItem>();
                        
                         // generate menu
                        
                         return menu;
                         }


                        And the JSF:
                        <ui:define name="sidebar">
                         <ice:form>
                         <ice:menuBar orientation="vertical">
                         <ice:menuItems value="#{sideNavigationMenu.panelNavigationItems}" />
                         </ice:menuBar>
                         </ice:form>
                        </ui:define>


                        But I've another problem: As soon as I click on a menu item, an ICEfaces dialog pops up telling me the session is expired. What's that?

                        • 9. Re: Seam And ICEFaces menubar
                          davidalves

                          Thanks, It finally works!!!!!!!!!!!!!!!!!!!!!!! I had already tryed that but I always kept the property not only the getter.

                          I don't seam to have the "session expired" warning, the only thing I'm doing different is that I keep may menu in the SESSION scope.