Java Reference
In-Depth Information
In our example, we use a simple CDI named bean with several properties and
corresponding setters and getters. Note the use of the @PostConstruct and
@PreDestroy annotations in the example. These are CDI annotations that are invoked
just after a CDI named bean is created and just before it is destroyed, respectively. We
added these annotations to confirm that our flow-scoped CDI named bean is being
created and destroyed as we enter and leave our registration flow.
Now, we need to add the JSF pages in our flow. The first page in the flow needs to
be named after the flow itself (in our example, registration.xhtml ). There is no
restriction about the naming of other pages in the flow. The last page in the flow must
be outside the flow directory, and must be named after the flow and suffixed with
-return . For our example, the page name will be registration-return.xhtml .
The markup for the pages doesn't illustrate anything we haven't
seen before; therefore, we will not show it. All example code is
available as part of this topic's code bundle.
After adding all of the necessary files, our project should look like this:
We enter our flow by setting the name of the flow as the value of the action
attribute of an <h:commandLink> or <h:commandButton> component.
In our example, we added a simple <h:commandButton> tag to index.xhtml :
<h:commandLink action="registration">
<h:outputText value="Begin Registration"/>
</h:commandLink>
 
Search WWH ::




Custom Search