Jsf 2 Introduction

What Is JavaServer Faces?

JavaServer Faces is a standard Java framework for building user interfaces for Web applications.

It simplifies the development of user interfaces for Java Web applications in the following ways:

-> It provides a component-centric, client-independent development approach to building Web user interfaces, thus improving developer productivity and ease of use.

-> It simplifies the access/management of application data from the Web user interface.

-> It automatically manages the user interface state between multiple requests.

JSF combines an MVC design approach with a powerful, component-based UI development framework that greatly simplifies Java EE Web development while using existing markup and servlet technologies

JSF Application Architecture

JSF technology is based on the Model View Controller (MVC). JSF application is really just a standard Java EE Web application with a few specific configurations:

web.xml-It has entry for faces controller servlet.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	   id="WebApp_ID" version="3.0">
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-name>Faces Servlet</servlet-name>

faces-config.xml-It is optional. It is used for configuration of all elements of a JSF application. If we are not using it then we can use annotations. JSF has Java annotations for nearly everything that can be put in to the faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>


When running an application in a container that does not provide built-in support for JSF, the libraries composing the JSF implementation must be included in WEB-INF/lib.

Building JSF applications with XHTML is done by using JSF-enabled Facelets tag libraries. For an XHTML page to be JSF-enabled, it must first contain JSF XML namespace directives provided by a JSF implementation.

The following namespace directives are for the Core and HTML libraries available from all JSF implementations:

	<html xmlns="http://www.w3.org/1999/xhtml"

Model- Beans which carries data.

View- UI which can be implemented using xhtml pages.

Controller- Faces Servlet which act as a controller and specified in web.xml