Java Reference
In-Depth Information
<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>
Again, there is nothing special we need to do to access the named beans properties
from the preceding markup. It works just as if the bean was a JSF managed bean.
The preceding page renders as follows:
As we can see, CDI applications work just like JSF applications. However, CDI
applications have several advantages over JSF, for example (as we mentioned
previously) CDI beans have additional scopes not found in JSF. Additionally, using
CDI allows us to decouple our Java code from the JSF API. Also, as we mentioned
previously, CDI allows us to use session beans as named beans.
 
Search WWH ::




Custom Search