Configuring JavaServer Faces implementation
Use this task to specify which JavaServer Faces implementation to use. You can use Apache MyFaces 2.0 or the Sun Reference Implementation 1.2 of JSF, or your own implementation.
Before you begin
The JSF implementation is a server-wide configuration setting. Thus, if you have multiple applications which require different JSF implementations, you must separate the applications into different application servers or clusters, and specify the implementation by following the steps in this topic for each application server or cluster. Alternatively, you can use an isolated shared library, as described for third-party JSF implementations, as follows.
About this task
- Do not use one classloader for the entire application. Each module needs its own classloader for JSF.
- Ensure that the isolated shared library is associated with the module and not the application.
- Ensure that the configuration listener is specified in the web.xml file. For example, specify the configuration listener of com.sun.faces.ConfigureListener for the Sun Reference Implementation of JSF 1.2.
- Add the third-party listener to the required web.xml file.
- Add the third-party JSF implementation Java™ archive (JAR)
files and its required dependent JAR files to the application as an isolated shared library and
associate it with your application:
- Move the JSF JAR files and all third-party libraries referenced by the JSF JAR files and UI component plug-ins (for example, PrimeFaces, ICEFaces, or RichFaces) to a directory outside of the application. If the application uses JWL, move the jsf-ibm.jar file to that directory as well.
- Create the isolated shared library. See topic Creating shared libraries for information about how to create the shared library.
- Ensure the classloader is set to PARENT_FIRST, the default value. To view the current configuration in the administrative console panel, click .
- If you are using a third-party MyFaces implementation, set the JSF implementation to Sun RI. To change this configuration in the administrative console panel, click JSF implementation, select Sun RI from the drop-down menu. . Under
- If you are using a different third-party JSF implementation, keep the JSF implementation set to the default value.
- Restart the application server.
You can also configure the JSF implementation on the Provide JSP reloading options for web modules panel for application installation and update wizards.
Procedure
- In the administrative console, click Select one of the following implementations:
- Sun Reference Implementation 1.2 - Select this option to use the Sun Reference Implementation 1.2 JSF implementation.
- MyFaces 2.0 - Select this option to use the MyFaces 2.0 JSF implementation. This option is the default JSF implementation.
- Using the wsadmin tool:
- An example of setting a single server to use the Sun RI 1.2 JSF
implementation:
wsadmin>set server [$AdminConfig list ApplicationServer *server1*] server1(cells/myNode01Cell/nodes/myNode01/servers/server1|server.xml#ApplicationServer_1183122130078) wsadmin>$AdminConfig modify $server {{jsfProvider SunRi1.2}} wsadmin>$AdminConfig save
- An example of setting a cluster to use the MyFaces 2.0 JSF
implementation:
wsadmin>set cluster [$AdminConfig list ServerCluster] cluster1(cells/myNode01Cell/nodes/myNode01/clusters/cluster1|cluster.xml#ServerCluster_1173916133721) wsadmin>$AdminConfig modify $cluster {{jsfProvider MyFaces}} wsadmin>$AdminConfig save
- An example of setting a Network Deployment environment to use the Sun RI 1.2 JSF implementation.
This script would only need to be run if the Precompile JavaServer Pages files option is selected
during the deployment of the
application:
wsadmin>set server [$AdminConfig list ApplicationServer *dmgr*] wsadmin>$AdminConfig modify $server {{jsfProvider SunRI1.2}} wsadmin>$AdminConfig save
- An example of setting a single server to use the Sun RI 1.2 JSF
implementation: