Configure JavaServer Faces implementation
Overview
For JSF we can use either...
- Apache MyFaces 2.0
- Sun Reference Implementation 1.2 of JSF
- Third-party JSF implementation
The WAS JSF engine...
- Determines if the Sun RI 1.2 or Apache MyFaces 2.0 is used from the appserver run time.
- Registers the correct listener class with the web container.
Configure the JSF implementation
From the WAS Admin console, go to...
Applications | Application Types | WebSphere enterprise applications | application_name | JSP and JSF options
...and select an implementation...
- Sun Reference Implementation 1.2
- MyFaces 2.0
To set with wsadmin.sh:
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
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 saveConfigure JSF engine parameters as required.
Notes
For multiple applications requiring different JSF implementations, separate the applications into different application servers or clusters, then follow these steps for each server/cluster. Alternatively, use an isolated shared library.
You do not need to add com.sun.faces.ConfigureListener or org.apache.myfaces.StartupConfigureListener to web.xml.
To use a third-party JSF implementation that is not shipped with the product...
- Add the third-party listener to the required web.xml file.
- Add the third-party JSF implementation JAR files and its required dependant JAR files to the application as an isolated shared library and associate it with the application:
- Move the JSF JAR files and all 3rd party libraries referenced by the JSF JAR files and UI component plugins (for example, PrimeFaces) to a directory outside of the application.
- Create the isolated shared library. See topic Create shared libraries for information about how to create the shared library.
- Ensure the classloader is set to PARENT_FIRST, the default value.
Applications | Application Types | WebSphere enterprise applications | application_name | Class loading and update detection
- For a third-party MyFaces implementation, set the JSF implementation to Sun RI.
Applications | Application Types | WebSphere enterprise applications | application_name | JSP and JSF options | JSF implementation | Sun RI
- For a different third-party JSF implementation, keep the JSF implementation set to the default value.
- Restart the application server.
We can also configure the JSF implementation on the Provide JSP reloading options for web modules panel for application installation and update wizards.
Related concepts
JavaServer Faces widget library (JWL) JavaServer Faces
Related tasks
Configure Portlet Bridge for JavaServer Faces Manage JavaServer Faces implementations Create shared libraries Associate shared libraries with applications or modules JSF engine configuration parameters