title: Deprecated richfaces javax.faces.el.MethodBinding replacement use
body: <p>I found this piece of code works in that i can programmatically creates a richfaces dropdown menu.  But some of the code is deprecated.  Can anyone tell me what to put in instead of the deprecated calls?</p>
  
  <p>Thanks</p>
  
  <pre><code>     public HtmlDropDownMenu getMyMenu()
   {
    HtmlDropDownMenu menu = new HtmlDropDownMenu();
    menu.setValue( "Node Select" );
  
    HtmlMenuItem menuItem = new HtmlMenuItem();
    // TODO programmatically pass from getNodes into a String[] rather than an ArrayList of SelectItems
    String subOption = "myBox";   
    menuItem.setValue( subOption );
  
    Application app = FacesContext.getCurrentInstance().getApplication();
    javax.faces.el.MethodBinding mb = app.createMethodBinding( "#{PrismBacking.onItemClick}", new Class[] { ActionEvent.class } );
    menuItem.setActionListener( mb );
  
    menu.getChildren().add( menuItem );
    return( menu );
   }
  
   public void onItemClick( ActionEvent event )
   {
    Object obj = event.getSource();
  
    if( obj instanceof HtmlMenuItem )
    {
     HtmlMenuItem item = (HtmlMenuItem)obj;
     if( item != null )
     {
      lastItem = item.getValue().toString();
  
     }
    }
   }
  </code></pre>
  
  <p>deprecated code lines are:</p>
  
  <pre><code>   javax.faces.el.MethodBinding mb = app.createMethodBinding( "#{PrismBacking.onItemClick}", new Class[] { ActionEvent.class } );
    menuItem.setActionListener( mb );
  </code></pre>