HTML and CSS Reference
In-Depth Information
In the XHTML page, you can call the calculateAverage method by using #{maths.calculateAverage(10.5,
12.3)}, which outputs 11.4 .
The Flash Scope
The flash scope is a new scope introduced since the JSF 2.0. The flash scope concept is inspired from RoR (Ruby
on Rails). The flash scope means that “anything that is placed in the flash scope will be exposed to the next view
encountered by the same user session and then cleared out.” In other words, the objects in the flash scope will be
available ONLY for the next request of the same browser window .
The flash scope is useful if you want to keep information for a short time for the next request only, whether the
next request will result from an HTTP Redirect, a JSF form postback, or an HTTP GET for a new page. Let's see an
example to understand the flash scope.
The survey application is a simple application that consists of three pages:
input.xhtml , which asks the user for some information that is useful for the survey.
confirm.xhtml , which displays the information entered by the user and asks the user to
confirm or modify it.
final.xhtml , which is a “Thank you” page.
Listing 2-24 shows the input.xhtml page.
Listing 2-24. The input.xhtml Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns=" "
xmlns:ui=" "
xmlns:h=" "
xmlns:f=" " >
<ui:composition template="/WEB-INF/templates/simple.xhtml">
<ui:define name="title">
<ui:define name="content">
<h:panelGrid columns="3">
<h:outputText value="#{bundle['']} "></h:outputText>
<h:inputText id="userName"
<h:message for="userName" styleClass="errorMessage"/>
<h:outputText value="#{bundle['survey.user.age']}"></h:outputText>
<h:inputText id="age"
<f:convertNumber />
<h:message for="age" styleClass="errorMessage"/>
Search WWH ::

Custom Search