Configure for JavaServer Faces 2.2
We can configure WebSphere Application Server traditional v9.0 to use JSF 2.2 for improved developer efficiency and compatibility with modern paradigms.
Ensure that the application is configured for JavaServer Faces (JSF) using the specific web.xml context parameters for the implementation that we chose.
The JSF implementation is a server-wide configuration setting on v8.0 and later nodes. If we have multiple applications that require different JSF implementations, we must separate the applications into different application servers or clusters; then, specify the implementation for each application server or cluster. For v7.0 nodes, the JSF implementation is an application configuration setting. For v9.0 and later nodes, the Sun Reference 1.2 JSF implementation is not supported. Instead, use the MyFaces JSF implementation. Alternatively, we can use an isolated shared library, as described for third-party JSF implementations.
Apache MyFaces 2.2 is used from the product run time. Use Apache MyFaces 2.2, or our own implementation. We can also configure the JSF implementation on the Provide JSP reloading options for web modules panel for application installation and update wizards. Configure the server or cluster to use the JSF implementation that we want. Complete this task using the administrative console or the wsadmin tool.
Tasks
- In the administrative console panel, click...
Applications > Application Types > WebSphere enterprise applications > application_name > JSP and JSF options
- Select MyFaces 2.2 to use the default MyFaces JSF implementation. If we are using the wsadmin tool, see the following example of setting a cluster to use the MyFaces 2.2 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 saveAn example of setting a cluster to use the MyFaces 2.2 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
Be Aware: To use a third-party JSF implementation that is not included with the product:
- Add the third-party listener to the 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 third-party libraries referenced by the JSF JAR files and UI component plug-ins (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 that the classloader is set to PARENT_FIRST, the default value. To view the current configuration in the administrative console panel, click...
Applications > Application Types > WebSphere enterprise applications > application_name > Class loading and update detection.
What to do next
To use the FlowBuilder API to create Flows with FlowBuilder annotations, the relevant CDI producer method must be declared within a managed bean or a session bean class. To ensure that the class is managed correctly by CDI, give the producer method class a scope to define it as a managed bean, or set CDI bean-discovery-mode to all. We can set the CDI bean-discovery-mode to all in the beans.xml file in the web archive:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all"> </beans>
Subtopics
Related:
(ZOS) JavaServer Faces JavaServer Faces widget library (JWL) JavaServer Faces JavaServer Faces 2.2 feature functions Configure Portlet Bridge for JavaServer Faces Manage JavaServer Faces implementations Create shared libraries JSF engine configuration parameters