Skip Headers
Oracle® Coherence User's Guide for Oracle Coherence*Web
Release 3.7.1

E22620-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

9 Working with JSF and MyFaces Applications

JavaServer Faces (JSF) is a framework that enables you to build user interfaces for Web applications. MyFaces, from the Apache Software Foundation, provides JSF components that extend the JSF specification. MyFaces components are completely compatible with the JSF 1.1 Reference Implementation or any other compatible implementation.

For all JSF/MyFaces Web-Applications:

JSF and MyFaces attempts to cache the state of the view in the session object. This state data should be serializable by default, but there could be situations where this would not be the case. For example:

The JSF parameter javax.faces.STATE_SAVING_METHOD identifies where the state of the view is stored between requests. By default, the state is saved in the servlet session. Set the STATE_SAVING_METHOD parameter to client in the context-param stanza of the web.xml file, so that JSF stores the state of the entire view in a hidden field on the rendered page. If you do not, then JSF may attempt to cache that state, which is not serializable, in the session object.

Example 9-1 illustrates setting the STATE_SAVING_METHOD parameter in the web.xml file.

Example 9-1 Setting STATE_SAVING_METHOD in the web.xml File

...
<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>
...

For Instrumented Applications that use MyFaces

If you are deploying the MyFaces application with the Coherence*Web WebInstaller (that is, an instrumented application), then you might have to complete an additional step based on the version of MyFaces.

For Instrumented Applications that Use the JSF Reference Implementation (Mojarra)

If you are using Coherence*Web WebInstaller to deploy a Web application based on the JSF Reference Implementation (Mojarra), then you must declare the FacesServlet class in the servlet stanza of the web.xml file.

Example 9-3 Declaring the Faces Servlet in the web.xml File

...
<servlet>
     <servlet-name>Faces Servlet (for loading config)</servlet-name>
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
 </servlet>
...

For Non-Instrumented Applications that Use MyFaces and Coherence SPI

If you are using the Coherence SPI to deploy a Web application built with MyFaces, then nothing more needs to be done. This is the recommended method of running MyFaces with Coherence*Web.

For Non-Instrumented Applications that use the JSF Reference Implementation (Mojarra) and the Coherence SPI

If you are using the Coherence SPI to deploy a Web application based on the JSF Reference Implementation (Mojarra), then nothing needs to be done. This is the recommended method of running JSF with Coherence*Web.