7 Replies Latest reply on May 12, 2009 8:09 AM by nemeur

    richFaces tabPanel dynamique


      Hello all,

      I want to know how to include a page in the tabs (rich: tab) created dynamically from a java code.

      I test this piece of code but it gives nothing:

      <rich:tabPanel binding="#{tabBean.tabPanel}"/>

      CODE JAVA:

      public HtmlTabPanel getTabPanel() {

      FacesContext context = FacesContext.getCurrentInstance();
      Application application = context.getApplication();

      tabPanel = (HtmlTabPanel)application.createComponent(HtmlTabPanel.COMPONENT_TYPE);

      HtmlTab tab = (HtmlTab)application.createComponent(HtmlTab.COMPONENT_TYPE);
      tab.setLabel("Tab 1");

      Include include = (Include)application.createComponent(Include.COMPONENT_TYPE);
      include.setViewId("maPage.xhtml");

      tab.getChildren().add(include);
      tabPanel.getChildren().add(tab);

      return tabPanel;
      }

      Thank you in advance for your reply.