| Building Web Interfaces with JavaServer Faces
A new JavaPro article, written by Chris Schalk
an Oracle Product Manager, serves as an introduction to the JavaServer
Faces technology. The article provides a working example of the
new JavaServer Faces J2EE technology. In addition to providing an architectural
overview of JSF, a simple introductory sample application along with source
code is also provided.
|
The article and sample application cover the following JSF topics:
- JSF Life cycle
- JSF Application Configuration
- JSF Managed Beans
- JSF Navigation Model
- JSF Validation
- JSF UI Component Model and Usage
- JSF UI Component Actions
- Internationalization
|
|
 |
Sample Application Code:
The article references a sample "Login Application". Provided
below are the instructions to download and get up and running with this
basic JSF example application.
Important note: The sample application contains source code which is
completely up to date with the latest JSF
Proposed Final Draft/Beta 1.0 version which contrasts slightly with
the code snippets referenced in the JavaPro article as it predated the
PFD/Beta 1.0 spec by a few weeks.
This sample application is provided in 2 archive formats:
| Archive: |
Instructions: |
- Complete Web Archive (WAR) file - jsflogin.war (zipped)
|
Download the war file and deploy to your favorite J2EE container.
- Note: This application has been specifically tested with:
|
- Zipped Directories with Ant build script - loginsample.zip
|
The zipped directories contains the following:
- JSF Login Web application source code
- Ant build script : (Ant
version 1.5 was used in building this app.)
The Ant build script has the following dependency settings:
After downloading the dependent software and editing your Ant
build script variables, you will be able to build your own WAR
file.
|
Running the sample
in Oracle JDeveloper 10g Preview
It is possible to run the Web archive jsflogin.war
in Oracle JDeveloper
10g Preview by creating a project based on the War file along with
a few minor steps. Here's how:
- Download and extract the jsflogin.war file to a location
where JDeveloper can access it.
- In an open Workspace (or Application Workspace) create a new project
based on a War file: File->New->General->Projects->Project
from WAR file
- Name your project, "jsflogin" click next.
- Select the jsflogin.war file and finish the wizard. You will now have
a new "jsflogin" project based on jsflogin.war.
- Special: Change the project's J2EE Web Context Root to "jsflogin".
- Double click the project jsflogin.jpr to edit the project properties
- Locate Common->J2EE->J2EE Web Context Root and set to "jsflogin".
- Special: Replace the Webapp's jstl.jar and standard.jar with
the JSTL library from JDeveloper.
- Using a file explorer locate the jsflogin application's WEB-INF/lib
directory on the file system. <jdev_home>/mywork/yourworkspace/jsflogin/public_html/WEB-INF/lib
- Delete the files, standard.jar and jstl.jar.
- Now add the "JSTL" java library to the project. (This
library includes the versions of jstl.jar and standard.jar which
will run on a J2EE 1.3 container.)
- Edit the jsflogin project properties again. (Double click
on the project.)
- Locate Profiles->Libraries and add "JSTL" to
the selected libraries.
- Special: Turn off the "Make Project before running"
project setting. (This is required because the project will not compile
successfully due to a small bug in the preview version.)
- Edit project properties.
- Locate Profiles->Development->Runner->Options
- Uncheck the "Make Project" (Before Running) checkbox.
- That's it. You can now run the application in JDeveloper 10g Preview
by right-clicking index.html and selecting "Run index.html".
|