1 Reply Latest reply on Apr 4, 2008 7:34 PM by Sergey Smirnov

    binding toolbar

    James May Newbie

      I'm probably doing something really stupid, but I can't get the binding of the rich:toolBar to work correctly with managed bean.

      Debugging in Netbeans, I can see that the bean is being used, but the changes are not reflected during the render. The bean adds two child components to the toolbar. The toolbar shows up on the page, but is empty.
      I am using the new version of Richfaces with JSF 1.2 and latest version of the Sun Application Server.

      code snippets:

      JSP File:

      <rich:toolBar binding="#{toolBars.unitFormToolBar}" height="32" itemSeparator="line" />


      Managed Bean Code:

      public class ToolBars
      {
       private HtmlToolBar unitFormToolBar = new HtmlToolBar();
      
       public HtmlToolBar getUnitFormToolBar()
       {
       return this.unitFormToolBar;
       }
      
       public void setUnitFormToolBar(HtmlToolBar tBar)
       {
       this.unitFormToolBar = tBar;
       }
      
       /** Creates a new instance of ToolBars */
       public ToolBars()
       {
       HtmlToolBarGroup toolBarGroup2 = new HtmlToolBarGroup();
      
       ImageComponent detailImage = new ImageComponent();
       detailImage.setUrl("/Images/Icons/Categories.png");
       detailImage.setStyle("width: 32px;height: 32px");
      
       toolBarGroup2.getChildren().add(detailImage);
      
       StringBuffer sb = new StringBuffer();
       sb.append("SCOPE=" + Scope.UNIT_DETAIL.getScopeId());
      
       Hyperlink detailLink = new Hyperlink();
      
       detailLink.setUrl("/faces/Index?" + sb.toString());
       detailLink.setText("TO DETAIL");
      
       toolBarGroup2.getChildren().add(detailLink);
      
       this.unitFormToolBar.getChildren().add(toolBarGroup2);
       }
      
      }
      


      Class configured as toolBars name in the managed beans xml file with Request scope.

      Jim