+

Search Tips   |   Advanced Search

 

JavaServer Faces

 

JavaServer Faces (JSF) is a user interface framework or application programming interface (API) that eases the development of Java based Web applications. WAS version 6.1 supports JavaServer Faces 1.1 at a runtime level, therefore using JSF reduces the size of the Web application since runtime binaries no longer need to be included in your Web application. The JSF runtime also :

The Sun JSF Reference Implementation provides the foundation of the code used for the JSF support in WAS. However, some dependencies on Jakarta APIs have been removed and replaced with Application Server specific solutions as a result of potential problems that may occur when open source APIs are included in the Application Server runtime. For example, when included in the Application Server runtime, these open source APIs are made available to all applications installed within the Application Server, therefore bringing versioning, support and legal issues. The version of the JSF runtime provided by the Application Server resides in the normal runtime library location and is available to all Web applications that leverage JSF APIs. The loading of the JSF servlet works in the same manner as if the runtime was packaged with the Web application. The following open source dependencies are replaced with other APIs or in-house versions:

The JSF Specification requires JavaServer Pages Standard Tag Library (JSTL) as a dependency, therefore the required version of the JSTL from Jakarta is made available in the Application Server runtime. Figure 1. Current external API dependencies from the Sun based JSF runtime

Figure 2. Replacement APIs

The specification related classes (javax.faces.*) for JSF and the IBM modified version of the JSF Sun reference implementation are packaged in the Application Server runtime.

Typically Web applications that leverage this API/Framework embed the JSF API and implementation JAR files within their WAR file. This is not required when these Web applications are deployed and run within WebSphere Application Server. Only the removal of these jars along with any JSTL JAR files from the WAR file is required.

If a Web application requires the use of its own version of JSF or JSTL embedded within it, you can change the class loader mode of the Web application. By default this is set to PARENT_FIRST mode. Changing this value to PARENT_LAST allows the Web application version of the JSF or JSTL classes to load before the WAS.

 

FacesAssert class

The Sun Reference implementation uses a utility class from Mozilla to perform assertion style calls to method parameters. The faces assert class provides equivalent functionality. The option of leveraging the assertion functionality available in JDK 1.4 is not possible due to the requirement of providing JVM level parameters to turn on assertion code support. The FacesAssert class only contains static method and has no life cycle.

FacesAssert
+ notEmpty ( [in] str : String ) : boolean
+ nonNull ( [in] isNull : Object ) : boolean
+ wsAssert ( [in] message : String ) : boolean
+ wsAssert ([in] argument : boolean , [in] message : String ) : boolean

 

FacesBeanUtils class

The FacesBeanUtils class provides static method replacements for methods 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

 

Faces configuration parser

The Sun Reference Implementation of JavaServer Faces use the Jakarta Commons Digester API to parse Faces configuration files. An XML SAX based parser is provided for the Application Server . The Digester code uses reflection code to perform its parsing. This has been found to be quite slow when large configuration files are parsed. The FaceConfigParser class in the diagram below is custom written for the Faces Configuration DTD and therefore parses large configuration files more quickly. Figure 3. Faces configuration parser




 

Related concepts


Web applications

 

Related tasks


Task overview: Developing and deploying Web applications
Developing Web applications