Add dynamically a tab to rich:tabPanel.

Solution Verified - Updated -

Issue

  • Add dynamically a tab to rich:tabPanel.

We are trying to add a dynamic tab (with page) in a Rich Faces Tabbed panel:

<rich:tabPanel switchType="client"  id="tabs" binding="#{bean.tabPanel}" 
 selectedTab="Tabs2">

</rich:tabPanel>

<a4j:commandButton value="Create" id="btnid"
                    actionListener="#{bean.createTabs}" reRender="tabs" />

Managed Bean:

private HtmlTabPanel tabPanel;

public HtmlTabPanel getTabPanel() {
 return tabPanel;
}

public void setTabPanel(HtmlTabPanel tabPanel) {
 this.tabPanel = tabPanel;
}


public void createTabs(ActionEvent event) 
{
 HtmlTab newTab = (HtmlTab) application.createComponent(HtmlTab.COMPONENT_TYPE);
 newTab.setLabel("Label");
 newTab.setName("NewTab");
 tabPanel.setDir("rtl");

UIInclude include =(UIInclude) application.createComponent(UIInclude.COMPONENT_TYPE);

 include.setViewId("/newpage.jsf");

newTab.getChildren().add(include);

tabPanel.getChildren().add(newTab);
}

Problem Statement:

On clicking of the button, the tab is getting created successfully. But, the page (newpage.jsf) associated with that new tab is not getting displayed.

Environment

  • JBoss Enterprise Service Oriented Architecture Platform (SOA-P) 5.0.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content