Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way to create dynamically <rich:tab> elements?
    primarykey
    data
    text
    <p>Let say that I want to create a variable set of <code>&lt;rich:tab&gt;</code> elements within a <code>&lt;rich:tabPanel&gt;</code> component. So I tried to do that way:</p> <pre><code>&lt;rich:tabPanel switchType="client" ...&gt; &lt;ui:repeat value="#{myBean.myTabs}" var="tab"&gt; &lt;rich:tab name="#{tab.name}" label="#{tab.label}"/&gt; &lt;/ui:repeat&gt; &lt;/rich:tabPanel&gt; </code></pre> <p>But it didn't work, as no tab is rendered. I also got the following message in the logs:</p> <pre><code>j_id174: tab panel has no enabled or rendered tabs! </code></pre> <p>This problem seems to be encountered by others people, for example <a href="http://community.jboss.org/thread/5984" rel="noreferrer">here</a>.</p> <p>So as suggested by the previous thread, I replaced my <code>&lt;ui:repeat&gt;</code> by a <code>&lt;c:forEach&gt;</code> but the problem still occurs.</p> <hr/> <p>I have a way to solve this problem using the <code>binding</code> attribute of my <code>&lt;rich:tabPanel&gt;</code> component:</p> <pre><code>&lt;rich:tabPanel switchType="client" binding="#{tabNavigationBean.tabPanel}" &lt;/rich:tabPanel&gt; </code></pre> <p>and then in my Java bean:</p> <pre><code>private HtmlTabPanel tabPanel; // + getter and setter public void setTabPanel(HtmlTabPanel tabPanel) { this.tabPanel = tabPanel; if (tabPanel != null) { createTabs(); } } private void createTabs() { Application application = FacesContext.getCurrentInstance().getApplication(); HtmlTab newTab = null; for (DedicatedPageTab dpt : getDedicatedPageTabs()) { newTab = (HtmlTab) application.createComponent(HtmlTab.COMPONENT_TYPE); newTab.setLabel(dpt.getLabel()); newTab.setName(dpt.getName()); tabPanel.getChildren().add(newTab); } } </code></pre> <p><strong>This code is working</strong>.</p> <p>However, my question is to know if I can solve my problem <strong>without</strong> using the <code>binding</code> attribute (i.e. a 100% pure XHTML solution)?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload