5 Using JSF and JSTL
This chapter includes the following sections:
Using JSF and JSTL With Web Applications
JSF and JSTL are an integral part of Java EE 7 and, as such, are incorporated directly into WebLogic Server. All Java EE 7 technologies are present on the WebLogic Server classpath. No additional configuration is required to use any of the Java EE 7 technologies in your applications. Applications deployed to WebLogic Server can seamlessly make use of JSF 2.2 and JSTL 1.2 without requiring you to deploy and reference separate shared libraries, as needed in previous releases.
The Java EE 7 API JAR file is included in WL_HOME\wlserver\server\lib\javax.javaee-api.jar
, where WL_HOME
represents the top-level installation directory for WebLogic Server.
For information about referencing these shared libraries with your Web applications, see Creating Shared Java EE Libraries and Optional Packages in Developing Applications for Oracle WebLogic Server.
JavaServer Faces (JSF)
JavaServer Faces technology simplifies building user interfaces for JavaServer applications. Developers of various skill levels can quickly build Web applications by: assembling reusable UI components in a page, connecting these components to an application data source, and wiring client-generated events to server-side event handlers.
WebLogic Server supports the JSF 2.2 specification at https://jcp.org/en/jsr/detail?id=344
. For general information about JSF technology, see the product overview at http://www.oracle.com/technetwork/java/javaee/javaserverfaces-139869.html
.
If you selected to install the server examples with your WebLogic Server installation, you can use the following JSF 2.2 code examples:
-
"Using JSF Contracts"
-
"Using JSF File Upload"
-
"Using JSF Flows"
-
"Using JSF HTML5"
The JSF 2.2 examples are located in the ORACLE_HOME\wlserver\samples\server\examples\src\examples\javaee7\jsf
directory, where ORACLE_HOME
represents the directory in which you installed WebLogic Server.
For more information about the WebLogic Server code examples, see Sample Applications and Code Examples in Understanding Oracle WebLogic Server.
JavaServer Pages Standard Tag Libraries (JSTL)
The JavaServer Pages Standard Tag Library (JSTL) encapsulates as simple tags the core functionality common to many Web applications. JSTL has support for common, structural tasks, such as:
-
iteration and conditionals
-
tags for manipulating XML documents
-
internationalization tags
-
SQL tags
JSTL also provides a framework for integrating existing custom tags with JSTL tags.
WebLogic Server supports the JSTL 1.2 specification at http://jcp.org/en/jsr/detail?id=52
. For general information about JSTL technology, see the product overview at http://www.oracle.com/technetwork/java/jstl-137486.html
.
JSF Backward Compatibility
JSF is developed using the Java Community Process, and therefore, should be backward compatible through JSF 1.0 when compiling and at runtime.
Applications built for JSF 1.2 should run unmodified on WebLogic Server 12.2.1, assuming you remove any bundled JSF implementation from the application configuration. If you follow this process and applications do not run, WebLogic Server provides JSF and JSTL libraries that can be deployed and referenced by applications. See the following sections:
Note:
The jsf-2.0.war
deployable library, included in WebLogic Server, is empty, as applications built for JSF 2.0 will continue to run unmodified using the built-in JSF 2.2 implementation of WebLogic Server 12.2.1.
WebLogic Server includes the empty jsf-2.0.war
library to avoid any software that depends on its existence. You can leave references to the library unchanged without harm. However, Oracle recommends removing any references to this empty library, as these references add no functionality.
Deploying JSF and JSTL Libraries
Note:
In this release of WebLogic Server, you can deploy JSF 2.2 and JSTL 1.2 applications directly. For backward compatibility, use the following directions when deploying JSF 1.x and JSTL 1.1 applications.
When deploying JSF 1.2 applications, use the JSF and JSTL libraries which are provided as Web application libraries. You must deploy the libraries before deploying the Web application that is using JSF 1.2 or JSTL functionality. You can deploy the libraries using the WebLogic Server Administration Console or the command-line weblogic.Deployer
utility.
Here's an example of deploying a JSF 1.2 library using the weblogic.Deployer
command-line:
java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password weblogic -deploy -library d:/oracle_home/wlserver/common/deployable-libraries/jsf-1.2.war
This command deploys the JSF 1.2 library using the default library-name
, specification-version
and implementation-version
defined by the MANIFEST.MF
in the library.
After a library is deployed, the extension-name
, specification-version
and implementation-version
of the library can be found in the WebLogic Server Administration Console. This information can also be found in the MANIFEST.MF
file of the library WAR
file.
For more information about deploying a Web module, see Preparing Applications and Modules for Deployment in Deploying Applications to Oracle WebLogic Server.
Referencing a JSF or JSTL Library
To reference a JSF or JSTL library, a standard Web application can define a <library-ref>
descriptor in the application's weblogic.xml
file. Here is an example:
<library-ref> <library-name>jsf</library-name> <specification-version>1.2</specification-version> <implementation-version>1.2</implementation-version> <exact-match>false</exact-match> </library-ref>
For more information on referencing a Web application library, see Creating Shared Java EE Libraries and Optional Packages in Developing Applications for Oracle WebLogic Server.