HTML and CSS Reference
In-Depth Information
<h:outputText value="#{bundle['user.password']}"></h:outputText>
<h:inputSecret id="password"
value="#{flowScope.password}"
required="true"
requiredMessage="#{bundle['user.password.validation']}">
</h:inputSecret>
<h:message for="password" styleClass="errorMessage"/>
<h:outputText value="#{bundle['user.email']}"></h:outputText>
<h:inputText id="email"
value="#{flowScope.email}"
required="true"
requiredMessage="#{bundle['user.email.validation']}"
validatorMessage="#{bundle['user.email.invalid']}">
<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z]
[a-zA-Z\.]*[a-zA-Z]"/>
</h:inputText>
<h:message for="email" styleClass="errorMessage"/>
</h:panelGrid>
<h:commandButton value="#{bundle['application.cancel']}" action="flowReturn"
immediate="true"/>
<h:commandButton value="#{bundle['application.next']}" action="extraInfo"/> <br/>
</h:form>
</ui:define>
</ui:composition>
</html>
Using the
#{flowScope}
EL object, we can store the objects in the flow scope, and it is equivalent to
facesContext.getApplication().getFlowHandler().getCurrentFlowScope()
API. The expressions
#{flowScope.id}
,
#{flowScope.password}
, and
#{flowScope.email}
are binded with the user ID, password, and
e-mail input fields. Another important thing to notice is the
"cancel" CommandButton
's action, which is set to the
registration flow return ID (
"flowReturn"
); this means that when the
"cancel" CommandButton
is clicked then the user
will be forwarded to the home page. Listing 10-13 shows the second page in the registration flow (
extraInfo.xhtml
)
page.
Listing 10-13.
extraInfo.xhtml Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<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
"
>
<ui:composition template="/WEB-INF/templates/main.xhtml">
<ui:define name="title">
#{bundle['application.register.title']}
</ui:define>