Java Reference
In-Depth Information
In the above class, an instance of the Customer class is injected at runtime, this is
accomplished via the @Inject annotation, this annotation allows us to easily use
dependency injection in CDI applications.
The navigateToConfirmation() method in the above class is invoked when the
user clicks on the Submit button on the page. navigateToConfirmation() works
just like an equivalent method in a JSF managed bean would, that is, it returns
a string, and based on the value of this string the application navigates to an
appropriate page. Just like with JSF, by default the target page's name is the return
value of this method plus an XHTML extension. For example, if no exceptions are
thrown in the navigateToConfirmation() method, the user is directed to a page
named confirmation.xhtml .
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Success</title>
</h:head>
<h:body>
New Customer created successfully.
<h:panelGrid columns="2" border="1" cellspacing="0">
<h:outputLabel for="firstName" value="First Name"/>
<h:outputText id="firstName" value="#{customer.
firstName}"/>
<h:outputLabel for="middleName" value="Middle Name"/>
<h:outputText id="middleName" value="#{customer.
middleName}"/>
<h:outputLabel for="lastName" value="Last Name"/>
<h:outputText id="lastName" value="#{customer.lastName}"/>
<h:outputLabel for="email" value="Email Address"/>
<h:outputText id="email" value="#{customer.email}"/>
</h:panelGrid>
</h:body>
</html>
 
Search WWH ::




Custom Search