Java Server Faces (JSF) is "Swing for server-side applications". It presents a dynamically controlled sequence of screens through the user's web browser. Forms in the web screen can have widgets that the user can use to send data to the application. The data is sent when the user clicks on a form button. The application can respond by sending a new screen to the browser. An example login application can be run here.
JSF has these parts:
Some earlier web technologies intermingle HTML and code from programming languages such as Java. JSF keeps different languages in different files. JSF is well-supported by IDEs such as NetBeans and Eclipse.
There are two structures associated with a JSF application.
A JSF application is deployed as a WAR file. The structure of the WAR file is similar to the development structure except that Java source files are replaced by Java class files.
The WAR file for the login application has this structure:
In NetBeans the login application appears in the Projects pane as:
The Configuration Files folder is not shown expanded in the above screenshot. It contains the same files as the Web Pages/WEB-INF folder.
Unlike JSF, some earlier web technologies intermingle HTML and programming language code. Disadvantages include:
Professional web designers prefer not to deal with embedded code.
Professional programmers are notoriously unqualified for graphic design.
Model-View-Controller Architecture
Data Conversion
Validation and Error Handling
Internationalization
Custom Components
AJAX Support
Alternative Renderers
This is a simplified life cycle of a JSF request initiated by the browser. The important fact for now is that request data is extracted, decoded, and verified.
With AJAX (Asynchronous JavaScript with XMLHttpRequest) the response need not be an HTML page. It can be information used by the browser to dynamically modify its current web page. JavaScript is the language used on the browser. XMLHttpRequest is a JavaScript function for asynchronous data transfer.
More advanced JSF applications still use Java Beans for data management, and they frequently use the mechanism illustrated in the login example for navigation between web pages. In addition, JSF supports the following: