JBoss.orgCommunity Documentation
First, we should mention that JSF configuration file ( faces-config.xml ) is intended for registering JSF application resources such as Converters, Validators, Managed Beans and page-to-page navigation rules.
Now, let's look at how you can easily configure this file by means of a special graphical editor for JSF configuration file. The editor has three main views:
Diagram
Tree
Source
They can be selected via the tabs at the bottom of the editor.
Here, we will show you how to work with JSF configuration file through the Diagram view of the editor.
As you can see on the figure below, the Diagram view displays the navigation rules in the faces-config.xml:
If your diagram is large, make use of the Outline view. Within it you can switch to a Diagram Navigator mode by selecting the middle icon at the top of the view window. It allows you to easily move around the diagram. Just move the blue area in any direction, and the diagram on the left will also move:
To create a new page here, you should click the page icon (View Template) on the toolbar from the left and then click anywhere on the diagram. A New Page Wizard will appear.
To create a transition for connecting pages:
Select the transition icon from the toolbar (New Connection).
Click the source page.
Click the target page.
A transition will appear between the two pages:
It is also possible to create a new page with context menu by right-clicking anywhere on the diagram and selecting Rule...
To edit an existing transition, first select the transition line. Then, place the mouse cursor over the last black dot (on the target page). The mouse cursor will change to a big +. At this point, drag the line to a new target page:
You can find it more convenient to edit your JSF Configuration file in the Tree view of the VPE.
The view displays all JSF application artifacts referenced in the configuration file in a tree format. By selecting any node on the left, you can see and edit its properties which will appear in the right-hand area. Let's look at the structure of this tree more closely.
Under the Application node you can adjust JSF application specific settings such as internationalization, possibility to set extensions, add property and variable resolvers, etc.
The Components node is for registering custom JSF components. Right-click and choose New > Component or just press the Add button in the right-hand area to add a new component to the JSF Configuration file.
In the Add Component wizard you should set a component type and point to a component class by using the Browse button or create a new class for this component by using the Component-Class link.
Use the Render Kit node to create and register a set of related renderers for custom JSF components.
Under the Converters node you can create a converter class for your JSF application either with id or for a proper class. How to do that see the Create and Register a Custom Converter section.
The Managed Bean node is meant for creating and registering Bean classes in your JSF application. Read more on the topic in the Managed Beans chapter.
Use the Navigation Rules node to configure a navigation between the pages in your application: create a new navigation rule and adjust necessary properties for it in the right-hand area.
The same you can do in the Diagram view of the JSF Configuration file editor.
Under the Referenced Beans node you can add a new Referenced Bean and configure various properties for it. To learn more on this refer to the Create and Register Referenced Beans section.
The Validators node is needed to create validator classes for organizing the validation of your application data. You can read more on the topic in the Create and Register a Custom Validator section.
The Extensions node is for setting extensions for your faces-config.xml.
In the Tree view you can also edit the properties of the selected element with the help of the Properties view as shown below:
Here, we'll discuss how you can configure your faces-config.xml with the help of Source View.
The Source view for the editor displays a text content of the JSF configuration file. It is always synchronized with other two views, so any changes made in one of the views will immediately appear in the other:
You can also work in the Source view with the help of the Outline view. The Outline view shows a tree structure of the JSF configuration file. Simply select any element in the Outline view, and it will jump to the same place in the Source editor, so you can navigate through the source code with Outline view.
Here we'll discuss a very important features that JSF configuration file editor provides for work with JSF resources.
The JSF configuration file editor comes with a very useful OpenOn navigating feature. More fully you can read about it in our Visual Web Tools Guide.
Code Assist provides pop-up tip to help you complete your code statements. It allows you to write your code faster and with more accuracy.
Code assist is always available in the Source mode:
When you are developing your project, error checking is constantly provided. This greatly reduces your development time as it allows you to catch many of the errors during development.
Errors will be reported by verification facility:
Other errors are also reported.