Oracle GlassFish Server 3.0.1 Add-On Component Development Guide

Creating JavaServer Faces Pages for Your Tabs

A JavaServer Faces page for a tab uses the tag sun:tab. This tag provides all the capabilities of the Project Woodstock tag webuijsf:tab.

Example 3–6 Example JavaServer Faces Page for a Tab

In the example, the sampleTab.jsf file has the following content:

<sun:tab id="sampleTab" immediate="true" text="Sample First Tab">
        setSessionAttribute(key="serverInstTabs" value="sampleTab");

Note –

In the actual file there are no line breaks in the gf.redirect value.

In your own JavaServer Faces pages, specify the attributes of this tag as follows:


A unique identifier for the tab, in this case sampleTab.


If set to true, event handling for this component should be handled immediately (in the Apply Request Values phase) rather than waiting until the Invoke Application phase.


The tab name that appears in the tab set.

The JSF page displays tab content differently from the way the page for a node displays node content. It invokes two handlers for the command event: setSessionAttribute and gf.redirect. The gf.redirect handler has the same effect for a tab that the url attribute has for a node. It navigates to a simple JavaServer Faces page called tabPage.jsf, in the src/main/resources/page/ directory, passing the text “Sample First Tab” to the page in a name parameter.

The sampleSubTab1.jsf and sampleSubTab2.jsf files are almost identical to sampleTab.jsf. The most important difference is that each sets the session attribute serverInstTabs to the base name of the JavaServer Faces file that corresponds to that tab:

setSessionAttribute(key="serverInstTabs" value="sampleTab");
setSessionAttribute(key="serverInstTabs" value="sampleSubTab1");
setSessionAttribute(key="serverInstTabs" value="sampleSubTab2");