TabView - Model

Tabview can display dynamic number of tabs backed by a model. As tabs are generated on-the-fly it is easy to implement adding/removing tabs as well.

Name: Messi
Number: 10
Position: CF

Source

<p:tabView id="tabView" var="player" value="#{tabBean.players}">

    <p:tab id="playerTab" title="#{player.name}">
        <h:panelGrid columns="2" cellpadding="10">
            <p:graphicImage id="playerImg" value="/images/barca/#{player.photo}" />

            <h:panelGrid columns="2" cellpadding="10">
                <h:outputText value="Name: " />
                <h:outputText id="playerName" value="#{player.name}" style="font-weight: bold"/>

                <h:outputText value="Number: " />
                <h:outputText id="playerNumber" value="#{player.number}" style="font-weight: bold"/>

                <h:outputText value="Position: " />
                <h:outputText id="playerPosition" value="#{player.position}" style="font-weight: bold"/>
            </h:panelGrid>

        </h:panelGrid>

    </p:tab>

</p:tabView>