Tag Archives: JSF

JSF2 Tutorials Videos :How to Create a Simple Java Server Faces (JSF) Application WAR File for J2EE/JEE5 Deployment

Here is another awesome video from Cameron Mckenzie on JSF2.

Cameron Mckenzie is the author of JSF2 Made Easy

In his book – JSF Made Easy helps you learn quickly as it takes you through a number of fun and easy to understand examples that demonstrate both the power and simplicity of the JSF framework. The examples in the book are clear and concise, relatively small in size so they are easily reproduced, and they hit the core concepts hard without ever distracting you with unnecessary code, superfluous classes and peripheral concepts that detract from your learning.

Get this book from amazon.com

The below video tutorial demonstrates how to create a proper war structure, do a basic web.xml deployment descriptor configuration for the FacesServlet that implements the FrontController Design Pattern, and it shows a simple faces-config.xml file.



JSF JSTL Twin Tag Libraries ( Difference between JSTL taglibs “core_rt” and “core” and other explained)

The JSTL tag library comes in two flavors that differ only in the way they support the use of runtime expressions for attribute values.

One library supports the request time expression values, and another supports the expression language.

The URIs of the RT-based tag libraries simply have the “_rt” suffix appended.

EL-based tag libraries:

Functional Area                      URI                                             Prefix
Core                                      http://java.sun.com/jstl/core        c
XML Processing                       http://java.sun.com/jstl/xml          x
Internationalization                  http://java.sun.com/jstl/fmt         fmt
Database Access                      http://java.sun.com/jstl/sql         sql

Runtime-based tag libraries
Functional Area                      URI                                            Prefix
Core                                     http://java.sun.com/jstl/core_rt     c_rt
XML Processing                      http://java.sun.com/jstl/xml_rt     x_rt
Internationalization                 http://java.sun.com/jstl/fmt_rt     fmt_rt
Database Access                     http://java.sun.com/jstl/sql_rt     sql_rt

To use an EL-based JSTL library, we must declare the library using a taglib directive, similar to declaring a regular custom tag library:

<@ taglib prefix=”c” uri=”http://java.sun.com/jstl/core”>

To use a runtime-based JSTL tag library, we must declare the library using a taglib directive as below

<@ taglib prefix=”c_rt” uri=”http://java.sun.com/jstl/core_rt”>

What does Core Tag Library supports?

It supports actions, including – output, manipulation of scoped variables, conditional logic, loops, URL manipulation, and error handling.

Other General Purpose Tags are for writing data, saving data to memory, deleting data, and handling errors:<c:out>, <c:set>, <c:remove>, and
<c:catch>.

we can use <c:out> to write data, as in the following example:

The name of your country is:
        <c:out value=”${person.country}” default=”unknown”/>

Conditional Actions:

The JSTL conditional actions supports simple conditional execution like <c:if> and mutually exclusive conditional execution
using <c:choose>, <c:when>, and <c:otherwise>.

The <c:if> tag allows us to conditionally include a piece of the page, depending on runtime information.

For example, the following snippet of code checks if a customer is based in India:

<c:if test=”${customer.country == ‘India’}”>
       This customer is based in India
</c:if>