Introduction to Configuring ADF Faces
Introduction to
Configuring ADF Faces
A JSF web application requires a specific set of
configuration files, namely, web.xml
and faces-config.xml
.
ADF applications also store configuration
information in the adf-config.xml
and adf-settings.xml
files. Because ADF Faces shares the same code base with My Faces Trinidad,
a JSF application that uses ADF Faces components for the UI also must include
a trinidad-config.xml
file, and optionally a trinidad-skins.xml
file.
Configuration in web.xml
Part of a JSF application's configuration is determined by
the contents of its Java EE application deployment descriptor, web.xml
.
The web.xml
file, which is located
in the /WEB-INF
directory, defines everything about your application
that a server needs to know (except the root context path, which is
automatically assigned for you in JDeveloper, or assigned by the system
administrator when the application is deployed
Typical runtime settings in the web.xml
file
include initialization parameters, custom tag library location, and security
settings.
·
Context parameter javax.faces.STATE_SAVING_METHOD
set to client
The following is configured in the web.xml
file for all applications
that use ADF Faces:
·
Context parameter javax.faces.STATE_SAVING_METHOD
set to client
·
MyFaces Trinidad filter and mapping
·
MyFacesTrinidad resource servlet and mapping
How to Configure for JSF and ADF
Faces in web.xml
In JDeveloper, when you create a project that
uses JSF technology, a starter web.xml
file with default
servlet and mapping elements is created for you in the /WEB-INF
directory.
When you use ADF Faces components in a project (that is, a component
tag is used on a page rather than just importing the library), in addition to
default JSF configuration elements, JDeveloper also automatically adds the
following to the web.xml
file for you:
·
Configuration elements that are related to MyFaces Trinidad filter
and MyFaces Trinidad resource servlet
·
Context parameter javax.faces.STATE_SAVING_METHOD
with the value
of client
When you elect to use JSP fragments in the application,
JDeveloper automatically adds a JSP configuration element for recognizing and
interpreting .jsff
files in the application.
shows the web.xml
file
with the default elements that JDeveloper adds for you when you use JSF and ADF
Faces and .jsff
files.
Generated web.xml File example:
<?xml version = '1.0' encoding = 'windows-1252'?><web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<description>Empty web.xml
file for Web Application</description>
<servlet>
<servlet-name>Faces
Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces
Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>35</session-timeout>
</session-config>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>
To add ADF Faces configuration
elements in web.xml:
1.
In the Application Navigator, double-click web.xml to open the file.
By default, JDeveloper opens the web.xml
file in the overview
editor, as indicated by the active Overview tab at the bottom of
the editor window.
When you use the overview editor to add or edit entries
declaratively, JDeveloper automatically updates the web.xml
file for you.
2.
To edit the XML code directly in the web.xml
file, click Source at the bottom of the
editor window.
When you edit elements in the XML editor, JDeveloper automatically
reflects the changes in the overview editor.
Required Elements in web.xml
The required, application-wide configuration elements for JSF and ADF Faces
in the web.xml
file
are:
javax.faces.STATE_SAVING_METHOD
: Specifies where to
store the application's view state. By default this value is server
,
which stores the application's view state on the server. It is recommended that
you set javax.faces.STATE_SAVING_METHOD
to client
when
you use ADF Faces, to store the
Comments
Post a Comment