Java Reference
In-Depth Information
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:body>
<h:form>
<h:panelGrid columns="2">
<h:outputLabel for="name"
value="Name" />
<h:inputText id="name"
value="#{customer.name}" />
<h:outputLabel for="lastName"
value="Surname" />
<h:inputText id="surname"
value="#{customer.surname}" />
<h:panelGroup />
</h:panelGrid>
</h:form>
</h:body>
</html>
If you want to use a different naming policy for your bean, you could use the @Named
annotation as follows:
@Named(value="customNamedBean")
This way, we will be able to reference our CDI Beans using the identified custom-
NamedBean value.
CDI scopes
CDI Beans come with a set of predefined scopes and annotations and each CDI
Bean has a distinct lifecycle determined by the scope they belong to. The following
table describes the built-in CDI scopes and the annotations required to set them:
Search WWH ::




Custom Search