0 Replies Latest reply on Dec 7, 2007 9:19 PM by shariffs

    org.richfaces.component.html.HtmlDropDownMenu()

    shariffs

      Hi I am using org.richfaces.component.html.HtmlDropDownMenu() to generate menu dynamically, everything is working fine, but having problem in execute a jsp once the user selects a menuItem. Any code help or suggestion will be appreciated.

      
      HtmlMenuItem menuItem = new HtmlMenuItem();
       menuItem.setValue(menuName1);
       javax.faces.application.Application app = javax.faces.context.FacesContext.getCurrentInstance().getApplication();
       javax.faces.el.MethodBinding mb = app.createMethodBinding( "#{webmenu.onItemClick}", new Class[] { javax.faces.event.ActionEvent.class } );
       menuItem.setActionListener( mb );
       menu.getChildren().add( menuItem );
      
      
      public void onItemClick( javax.faces.event.ActionEvent event)
       {
       try
       {
       Object obj = event.getSource();
      
       if( obj instanceof org.richfaces.component.html.HtmlMenuItem )
       {
       org.richfaces.component.html.HtmlMenuItem item =
       (org.richfaces.component.html.HtmlMenuItem)obj;
       if( item != null )
       {
       lastItem = item.getValue().toString();
       System.out.println("lastItem Shariff = "+lastItem);
       }
       }
       }
       catch(Exception e)
       {}
       }