A <tc:tabGroup/> can contain several <tc:tab/> tags. Switching between tabs can be done on the client or by server request. For server requests there are two ways. Reload the whole page and reload only the tab (Ajax). To set the switching type, use the switchType attribute. By default it's client side.
<tc:tabGroup/>
<tc:tab/>
switchType
<tc:tabGroup>
<tabGroup switchType="reloadTab">
<tabGroup switchType="reloadPage">
<?xml version="1.0" encoding="UTF-8"?> <!-- * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. --> <ui:composition template="/main.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:tc="http://myfaces.apache.org/tobago/component" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"> <ui:param name="title" value="#{demoBundle.tab}"/> <p>A <code class="language-markup"><tc:tabGroup/></code> can contain several <code class="language-markup"><tc:tab/></code> tags. Switching between tabs can be done on the client or by server request. For server requests there are two ways. Reload the whole page and reload only the tab (Ajax). To set the switching type, use the <code>switchType</code> attribute. By default it's client side.</p> <tc:section label="#{demoBundle.tab_client}"> <pre><code class="language-markup"><tc:tabGroup></code></pre> <tc:tabGroup id="tabGroupClient"> <tc:tab id="tab1Client" label="Tab One" markup="one"> Content of tab one. </tc:tab> <tc:tab id="tab2Client" label="Tab Two" disabled="true" markup="two"> Content of tab two. </tc:tab> <tc:tab id="tabNoneClient" label="Tab Not Rendered" rendered="false" markup="none"> This tab shouldn't be rendered. </tc:tab> <tc:tab id="tab3Client" label="Tab Three" markup="three"> Content of tab three. </tc:tab> </tc:tabGroup> </tc:section> <tc:section label="#{demoBundle.tab_ajax}"> <pre><code class="language-markup"><tabGroup switchType="reloadTab"></code></pre> <tc:tabGroup id="tabGroupAjax" switchType="reloadTab"> <tc:tab id="tab1Ajax" label="Tab One" markup="one"> Content of tab one. </tc:tab> <tc:tab id="tab2Ajax" label="Tab Two" disabled="true" markup="two"> Content of tab two. </tc:tab> <tc:tab id="tabNoneAjax" label="Tab Not Rendered" rendered="false" markup="none"> This tab shouldn't be rendered. </tc:tab> <tc:tab id="tab3Ajax" label="Tab Three" markup="three"> Content of tab three. </tc:tab> </tc:tabGroup> </tc:section> <tc:section label="#{demoBundle.tab_server}"> <pre><code class="language-markup"><tabGroup switchType="reloadPage"></code></pre> <tc:tabGroup id="tabGroupFullReload" switchType="reloadPage"> <tc:tab id="tab1FullReload" label="Tab One" markup="one"> Content of tab one. </tc:tab> <tc:tab id="tab2FullReload" label="Tab Two" disabled="true" markup="two"> Content of tab two. </tc:tab> <tc:tab id="tabNoneFullReload" label="Tab Not Rendered" rendered="false" markup="none"> This tab shouldn't be rendered. </tc:tab> <tc:tab id="tab3FullReload" label="Tab Three" markup="three"> <f:facet name="bar"> <tc:link image="fa-remove" omit="true"> <tc:dataAttribute name="alert-text" value="Not implemented yet!"/> </tc:link> </f:facet> Content of tab three. </tc:tab> </tc:tabGroup> </tc:section> </ui:composition>