JavaServer Faces

JavaServer Faces (JSF) is a user interface framework or application programming interface (API) that eases the development of Java based Web applications. Using JSF reduces the size of the Web application, because you no longer need to include runtime binaries in your Web application. The application server supports JSF at a runtime level.

The JSF runtime:

The Sun JSF Reference Implementation provides the foundation of the code that is used for JSF support in the application server. Some dependencies on Jakarta APIs have been removed, however, and replaced with solutions that are specific to the application server, because there is a possibility of unforeseen issues when you use open source APIs in the application server's runtime environment. For example, when you include open source APIs in the application server's runtime environment, these open source APIs are made available to all applications that are installed within the application server. Therefore, these APIs can cause versioning, support, and legal issues. The version of the JSF runtime environment that is provided by the application server resides in the location of the normal runtime library, and this version is available to all Web applications that leverage JSF APIs. The loading of the JSF servlet works as if the runtime environment was packaged with the Web application.

The following open source dependencies are replaced with other APIs or unique versions for the application server: The JSF specification requires JavaServer Pages Standard Tag Library (JSTL) as a dependency, so the required version of the JSTL from Jakarta is made available in the application server runtime environment.
Figure 1. Current® external API dependencies from the Sun based JSF runtime
Figure 2. Replacement APIs

The classes that are related to the specification for JSF, named like javax.faces.*, and the IBM® modified version of the JSF Sun reference implementation are packaged in the application server runtime environment.

Typically, Web applications that leverage this API, or framework, embed the JSF API and the Java archive (JAR) files for the implementation within their Web archive (WAR) file. This is not required when you deploy these Web applications and run them within the application server.
Avoid trouble Avoid trouble: You are required to remove embedded JAR files and any JSTL JAR files from the WAR file.gotcha
JavaServer Faces has been part of the Java Platform, Enterprise Edition (Java EE) platform since Version 5, so a Web application does not need to bundle a JavaServer Faces implementation when it runs on a Web container that is Java EE technology compliant. If a JavaServer Faces implementation is bundled with a Web application, then the bundled implementation is ignored. The JavaServer Faces implementation that is provided by the platform always takes precedence.

The JSF runtime for the application server does not support the use of a single class loader for the entire application. This support is also not available when the application contains multiple Web modules, and one of those modules is a JSF module. A single class loader for the entire application is not supported, because the FacesConfig initialization requires a single class loader for each JSF module to perform the initialization. Therefore, you must use multiple class loaders when the application contains multiple Web modules and at least one of those modules implements the JSF framework.

If you want to use a third party JSF implementation that is not shipped with the product:
  1. Add the third party listener to the required web.xml file.
  2. Add the JAR files for the third party implementation to the application's web modules as a shared library
  3. Set your application's classloader to PARENT_LAST. The application server will use this classloader setting to load the Web application's version of the JSF or JSTL classes before loading the runtime for the application server.

FacesBeanUtils class

The FacesBeanUtils class provides static method replacements for methods that are used in the Jakarta Commons BeanUtils API. The FacesBeanUtils class has no life cycle.

FacesBeanUtils
+ getProperty ( [in] bean : Object , [in] property : String ) : Object
+ getPropertyType ( [in] bean : Object , [in] property : String ) : Class
+ getSimpleProperty ( [in] bean : Object , [in] property : String , [in] value : Object )
+ getProperty ( [in] bean : Object , [in] property : String , [in] value : Object )
+ convertFromString ( [in] value : String , [in] valueClass : Class ) : Object
+ convert ([in] targetType : Class , [in] bean : String ) : Object



Related tasks
Task overview: Developing and deploying Web applications
Developing Web applications
Concept topic Concept topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 31, 2013 12:02:36 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-zos&topic=cwebjavaserverfaces
File name: cweb_javaserver_faces.html