uCosminexus Application Server, Web Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

3.5.3 Servlet settings

The servlets settings are defined in web.xml. A web.xml file has different definitions for different versions of servlet.

Organization of this subsection
(1) For Servlet2.5
(2) For Servlet3.0

(1) For Servlet2.5

You must define the following tags in web.xml to run JSF applications:

Use the servlet tag to register the FacesServlet class as a servlet. Make the settings in the web.xml as follows:

<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>

You must define the servlet-mapping element in web.xml.

Make the settings in web.xml as follows:

<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

(2) For Servlet3.0

For Servlet3.0, processes such as registration of the FacesServlet class or definition of the URL mapping are done by default. You need not define any settings in web.xml and the creation of web.xml is also optional.

The following points describe how the program behaves depending upon whether you register the FacesServlet class and define the URL mapping in web.xml.

Condition 1:
Conditions
When either of the following conditions is fulfilled:
  • You create web.xml but do not register the FacesServlet class and do not define the URL mapping
  • You do not create web.xml
Behavior
FacesServlet is automatically initialized and is mapped to the following default URL:
  • /faces/*
  • *.jsf
  • *.faces
The user accesses the FacesServlet by using the default URL.

Condition 2:
Condition
You create web.xml and register the FacesServlet class, and define the URL mapping.
Behavior
The user accesses the FacesServlet according to the contents defined in web.xml. In such cases, the default settings described in Condition 1 above are not used.