JSF 2.0 Configuration

Now We do configuration for our JSF project -

JSF configuration files

JSF is based on the following configuration files:
  • web.xml - General web application configuration file 
  • faces-config.xml - Contains the configuration of the JSF application.  
  • index.xhtml


JSF requires the central configuration list web.xml in the directory WEB-INF of the application. This is similar to other web-applications which are based on servlets.
You must specify in web.xml that a "FacesServlet" is responsible for handling JSF applications. "FacesServlet" is the central controller for the JSF application. "FacesServlet" receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.


"faces-config.xml" allows to configure the application, managed beans, converters  validators, and navigation.


This will is going to render our view .we can have any name for this file which should have extension "xhtml".

Your first JSF project:

Create a new Dynamic Web Project "MyFristJSF2_Project". Under "Configuration" select "JavaServer Faces v1.2"

 Press next until you see the following screen.Here you need to add JSF2.0 jars.Below are the name of jar which need to add for a basic JSF 2.0 example.

Now jsut create a new XHML page named index.xhtml and you will find below given directory structure.

Now we are ready to execute our frist JSF2.0 example.


Post a Comment