TOC PREV NEXT INDEX




Configuring the Web Application


At the heart of it, the TimeZone application is a standard J2EE web application that requires a deployment descriptor. This means we need to create a web.xml file.

The code for the web.xml file is as follows:

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

 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
 
	2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
 

 
<web-app>
 

 
  <display-name>ICEfaces Tutorial: Timezone Part 1</display-name>
 
  
 
  <description>
 
		ICEfaces Tutorial: Timezone Part 1
 
  </description>
 
	
 
  <context-param>
 
	<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
 
	<param-value>server</param-value>
 
  </context-param>
 
  
 
  <context-param>
 
	<param-name>javax.faces.application.CONFIG_FILES</param-name>
 
	<param-value>/WEB-INF/faces-config.xml</param-value>
 
  </context-param>
 

 
  <!-- Faces Servlet -->
 
  <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 -->
 
  <servlet-mapping>
 
	<servlet-name>Faces Servlet</servlet-name>
 
	<url-pattern>*.faces</url-pattern>
 
  </servlet-mapping>
 
  
 
</web-app>
 

The deployment descriptor file for running under MyFaces (web_myfaces.xml) is only slightly different in that MyFaces requires the registration of a servlet context listener to start up properly.

<!-- This is the MyFaces context listener -->
 
<listener>
 
	<listener-class>org.apache.myfaces.webapp.StartupServletContextListener

									</listener-class>
 
</listener>
 

This is a fairly typical descriptor for a JSF application. The Faces Servlet is declared and configured to load on startup. The .faces extension is mapped to the faces Servlet.



Copyright 2005. ICEsoft Technologies, Inc.
http://www.icesoft.com

TOC PREV NEXT INDEX