HTML and CSS Reference
In-Depth Information
Finally, in order to define the Faces flow, you should declare it in the Faces configuration file ( faces-config.xml )
as shown in Listing 10-11.
Listing 10-11. Defining the Faces Flow in the Faces Configuration File
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns=" http://xmlns.jcp.org/xml/ns/javaee "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation=" http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd ">
<flow-definition id="registration">
<flow-return id="flowReturn">
<from-outcome>/home</from-outcome>
</flow-return>
</flow-definition>
...
</faces-config>
In order to define the flow, you use the <flow-definition> tag specifying the ID of the flow. The <flow-return>
tag represents the flow return and it must have one <from-outcome> element; in our weather application, the flow
return ID is "flowReturn" and the flow returns when the outcome "/home" is returned (which represents the home
page). Now, let's go through the registration pages. Listing 10-12 shows the registration.xhtml page.
Listing 10-12. registration.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>
<ui:define name="content">
<h:form>
<h:panelGrid columns="3">
<h:outputText value="#{bundle['user.id']}"></h:outputText>
<h:inputText id="userID"
value="#{flowScope.id}"
required="true"
requiredMessage="#{bundle['user.id.validation']}">
</h:inputText>
<h:message for="userID" styleClass="errorMessage"/>
 
Search WWH ::




Custom Search