HTML and CSS Reference
In-Depth Information
The following JSTL tags are used with the JSF deferred expressions in the example:
<c:forEach> for performing the iteration.
<c:choose> for defining a group of mutually exclusive choices. It is like the Java switch
statement.
<c:when> , which is like the Java case statement.
<c:other> , which is like the Java default statement.
In this example, the <c:forEach> iterates over the #{user.favoriteSport} list, and the current sport item is
represented by the #{sport} expression. The <c:when> tag checks if the current sport #{sport} value is 'Football'
and when it finds this value, the following sentence "Popular in Africa:" is highlighted and underlined and
appended to beginning of the list item. If the current sport does not equal 'Football' then the #{sport} is displayed
normally using the <c:otherwise> JSTL element. Figure 2-1 shows how the list items will appear.
Figure 2-1. The highlighted underlined list item
Note that in order to work with JSTL, you need to include the JSTL URI in the declaration, as shown in the
following bolded text:
<html xmlns=" http://www.w3.org/1999/xhtml "
xmlns:ui=" http://java.sun.com/jsf/facelets "
xmlns:h=" http://java.sun.com/jsf/html "
xmlns:f=" http://java.sun.com/jsf/core "
xmlns : c = " http://java.sun.com/jsp/jstl/core " >
In the JSF EL, there are two types of expressions:
Value expression.
Method expression.
In the next sections, we will dig into the details of both value and method expressions.
 
Search WWH ::




Custom Search