HTML and CSS Reference
In-Depth Information
<servlet-name>Faces Servlet</servlet-name>
<servlet-name>Faces Servlet</servlet-name>
In Listing 1-1, there are two main things you need to know: the first one is the definition of the Faces Servlet and its
mapping to the ( /faces/* ) URL using the <url-pattern> element. The second one is the javax.faces.PROJECT_STAGE
context parameter, which is set to Development (other possible values are Production , SystemTest , and UnitTest ).
Setting the project stage in the development mode makes the JSF framework generate additional messages in the page
when finding a common development mistake. This feature can help the JSF developers to become more productive
during the development time.
Finally, the <welcome-file> element specifies the welcome page of the application, which is the
index.xhtml file; this will make any request to http://localhost:8080/firstApplication/ redirected to
http://localhost:8080/firstApplication/faces/index.xhtml , which will trigger the Faces Servlet to prepare
the JSF context before going to the index.xhtml page.
In any Servlet 3.0 container such as GlassFish v3, the web.xml file is optional. If the web.xml is omitted, the
Faces Servlet will be automatically mapped to *.jsf , *.faces , and /faces/* urL patterns.
Now, let's move to the faces-config file, which includes the related JSF configuration. Actually, since JSF 2.0, the
faces-config file becomes optional because most of the JSF configuration can be defined using the Java annotations.
Listing 1-2 shows the firstApplication Faces configuration file.
Listing 1-2. The firstApplication Faces Configuration File
<faces-config version="2.1"
xmlns=" "
xmlns:xsi=" "
Search WWH ::

Custom Search