You can configure WebSphere® Application Server traditional
Version 9.0 to use JSF 2.2 for improved developer efficiency and
compatibility with modern paradigms.
Before you begin
Ensure that your application is configured for JavaServer Faces (JSF) by using the specific
web.xml context parameters for the implementation that you chose.Attention: The JSF implementation is a server-wide configuration setting on Version 8.0 and
later nodes. If you have multiple applications that require different JSF implementations, you must
separate the applications into different application servers or clusters; then, specify the
implementation for each application server or cluster. For Version 7.0 nodes, the JSF implementation
is an application configuration setting. For Version 9.0 and later nodes, the Sun Reference 1.2 JSF
implementation is not supported. Instead, use the MyFaces JSF implementation. Alternatively, you can
use an isolated shared library, as described for third-party JSF implementations.
About this task
Apache MyFaces 2.2 is used from the product run time. You can use Apache MyFaces 2.2, or
your own implementation. You 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 you want. Complete this task by using the
administrative console or the wsadmin tool.
Procedure
-
In the administrative console panel, click
-
Select MyFaces 2.2 to use the default MyFaces JSF implementation.
If you 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 save
An 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:
- 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.config.ConfigureListener for the
Sun Reference Implementation of JSF 1.2.
If you want to use a third-party JSF implementation that is not included with the product,
complete the following steps:
- Add the third-party listener to the 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 Creating 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 .
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. Ensure that the
class is managed correctly by CDI. Either give the producer method class a scope to define it as a
managed bean or set CDI bean-discovery-mode to all
. You can set the CDI
bean-discovery-mode to all
in the beans.xml
file in your 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>