The JavaServer Faces (JSF) 2.0 samples demonstrate three new features added to JSF 2.0. The features are Ajax, templating, composite components. These samples will show you how to create, process and render Ajax requests, along with using templates to create a standard layout for an application and composite components to create reusable components complete with their own converters, validators, renderers and listeners.
Here is what you should know about this sample before proceeding.
15 minutes
COPYRIGHT LICENSE: This information contains sample code provided in source code form. You may copy, modify, and distribute these sample programs in any form without payment to IBM for the purposes of developing, using, marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample code is written. Notwithstanding anything to the contrary, IBM PROVIDES THE SAMPLE SOURCE CODE ON AN "AS IS" BASIS AND IBM DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND ANY WARRANTY OR CONDITION OF NON-INFRINGEMENT. IBM SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR OPERATION OF THE SAMPLE SOURCE CODE. IBM HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS TO THE SAMPLE SOURCE CODE.
The following key phrases are associated with this sample: JSF 2.0, JavaServer Faces, Ajax, templating, composite components
The major advantage of using Ajax in your application is it saves you from processing and rendering the entire page view for a particular action. You can update components you want by using an Ajax request to process and render only the necessary part of a view. The Ajax sample will show you how to do this by using the f:ajax tag.
Templating is useful for applications with a common flow, such as a header and footer on each page. Using templates allows you to easily modify the content of your pages but keep the general layout the same. Composite components allow you to package JSF components with their own converters, validators, renderers and listeners as one reusable component. This module will show you how to use templating and composite components in an application.
Rebuild the sample (optional)
Install the sample
Run the sample
Uninstall the sample
The following illustration shows the correctly running sample:
Ajax Simple Text Display Results
Ajax Simple JavaScript Text Display Results
If you want to customize the applications, you can modify the classes or configuration files and run the build script again. If you want to add a configuration file, make sure you modify the build.xml file to add the newly created file into the correct JAR, WAR, or EAR file.