Sun GlassFish Enterprise Server v3 Prelude Add-On Component Development Guide

Creating a JavaServer Faces Page for Your Node

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


Example 3–3 Example JavaServer Faces Page for a Tree Node

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

<sun:treeNode id="treeNode1"
        text="SampleTop"
        url="/sample/page/testPage.jsf?name=SampleTop"
        target="main"
        imageURL="resource/sample/images/sample.png"
        >
        <sun:treeNode id="treeNodeBB"
        text="SampleBB"
        url="/sample/page/testPage.jsf?name=SampleBB"
        target="main"
        imageURL="resource/sample/images/sample.png"
        />
</sun:treeNode>

This file uses the sun:treenode tag to specify both a top-level tree node and another node nested beneath it. In your own JavaServer Faces pages, specify the attributes of this tag as follows:

id

A unique identifier for the tree node.

text

The node name that appears in the tree.

url

The location of the JavaServer Faces page that appears when you click the node. In the example, most of the integration points use a very simple JavaServer Faces page called testPage.jsf, which is in the src/main/resources/page/ directory. Specify the integration point id value as the root of the URL; in this case, it is sample (see Specifying the ID of an Add-On Component). The rest of the URL is relative to the src/main/resources/ directory, where sampleNode.jsf resides.

The url tag in this example passes a name parameter to the JavaServer Faces page.

target

The frame in which to display the JavaServer Faces page specified by the url tag. Normally, the value is main.

imageURL

The location of a graphic to display next to the node name. In the example, the graphic is always sample.png, which is in the src/main/resources/images/ directory. The URL for the deployed images directory is relative to resource/idval/, where idval is the integration point id value (see Specifying the ID of an Add-On Component).