I managed to kick start my(accelerated) learning in JSF using Rich Faces. After getting my Hello World Project to work I sat down to understand what each of the configuration does in the web.xml.
Then based on my understanding from various sources in the internet I came up with the following commented web.xml file
It may not be accurate but serves the purpose of understanding
Then based on my understanding from various sources in the internet I came up with the following commented web.xml file
It may not be accurate but serves the purpose of understanding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> | |
<display-name>RichFacesExperiment</display-name> | |
<welcome-file-list> | |
<welcome-file>index.html</welcome-file> | |
<welcome-file>index.htm</welcome-file> | |
<welcome-file>index.jsp</welcome-file> | |
<welcome-file>default.html</welcome-file> | |
<welcome-file>default.htm</welcome-file> | |
<welcome-file>default.jsp</welcome-file> | |
</welcome-file-list> | |
<context-param> | |
<param-name>org.richfaces.SKIN</param-name> | |
<param-value>emeraldTown</param-value> | |
</context-param> | |
<!-- JavaServer Faces defaults to JSP files for defining views | |
To define the suffix we want we must specify .xhtml or whatever is the pattern we want | |
--> | |
<context-param> | |
<param-name>javax.faces.DEFAULT_SUFFIX</param-name> | |
<param-value>.xhtml</param-value> | |
</context-param> | |
<!-- | |
Specifies if the state is saved on the client or on server | |
--> | |
<context-param> | |
<param-name>javax.faces.STATE_SAVING_METHOD</param-name> | |
<param-value>client</param-value> | |
</context-param> | |
<!-- | |
when set to true prints error messages on console | |
--> | |
<context-param> | |
<param-name>facelets.DEVELOPMENT</param-name> | |
<param-value>true</param-value> | |
</context-param> | |
<!-- | |
interval compiler checks for page changes lower values useful during development set to -1 if you don't want checks made. | |
--> | |
<context-param> | |
<param-name>facelets.REFRESH_PERIOD</param-name> | |
<param-value>1</param-value> | |
</context-param> | |
<!-- In production, no need to let comment in rendered html. | |
this will reduce the rendered html size while travarsing through newtwork wire. | |
--> | |
<context-param> | |
<param-name>facelets.SKIP_COMMENTS</param-name> | |
<param-value>false</param-value> | |
</context-param> | |
<!-- | |
The entry facelets.VIEW_MAPPINGS as *.xhtml tells facelets | |
that only navigation rules with to-view-ids that end in �.xhtml� | |
should be treated as facelets and everything else should be deferred back to the default view handler. | |
--> | |
<context-param> | |
<param-name>facelets.VIEW_MAPPINGS</param-name> | |
<param-value>*.xhtml</param-value> | |
</context-param> | |
<!-- Filters are like plugins --> | |
<filter> | |
<display-name>RichFaces Filter</display-name> | |
<filter-name>richfaces</filter-name> | |
<filter-class>org.ajax4jsf.Filter</filter-class> | |
</filter> | |
<!-- for ajax requests --> | |
<filter-mapping> | |
<filter-name>richfaces</filter-name> | |
<servlet-name>Faces Servlet</servlet-name> | |
<dispatcher>REQUEST</dispatcher> | |
<dispatcher>FORWARD</dispatcher> | |
<dispatcher>INCLUDE</dispatcher> | |
</filter-mapping> | |
<!-- Faces Servlet --> | |
<!-- All the requests go through the FacesServlet --> | |
<servlet> | |
<servlet-name>Faces Servlet</servlet-name> | |
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class> | |
<load-on-startup>1</load-on-startup> | |
</servlet> | |
<!-- Faces Servlet Mapping --> | |
<!-- All the requests/urls ending with .faces extension are redirected to the Faces Servlet --> | |
<servlet-mapping> | |
<servlet-name>Faces Servlet</servlet-name> | |
<url-pattern>*.faces</url-pattern> | |
</servlet-mapping> | |
</web-app> |