Next we shall discuss navigation in the
Facelets application. Add a Facelets composition page, error.xhtml,
for navigating to if an error is generated.
If the outcome from input.xhtml
is "output", navigate to output.xhtml
. If the outcome is "error", navigate to error.xhtml
. The outcome is the value returned by the action method—commandButton1_action
. We have used the implicit navigation provided by JSF 2.0 in which the navigation controller navigates to the Facelets page with the same name as the outcome of an action.
We have also used the @ManagedBean
annotation to declare a managed bean. faces-config.xml
becomes essentially an empty file with JSF 2.0 implicit navigation and the @ManagedBean
annotation specified in the managed bean.
<?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun...