Java Reference
In-Depth Information
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getEmail() {
return email;
public void setEmail(String email) { = email;
} }
The @Named annotation marks this class as a CDI named bean. By default, the bean's
name will be the class name with its first character switched to lowercase (In our
example, the name of the bean is "customer", since the class name is Customer). We
can override this behavior if we wish, simply by passing the desired name to the
value attribute of the @Named annotation, as follows:
A CDI named bean's methods and properties are accessible via Facelets, just like
a regular JSF managed bean.
Facelets is the default view technology for JSF 2.0. Refer to Chapter 4
for details.
Just like JSF-managed beans, CDI named beans can have one of the several scopes,
the above named bean has a scope of request, as denoted by the @RequestScoped
Request scoped beans are shared through
the duration of a single request. A single
request could refer to an HTTP request, an
invocation to a method in an EJB, a web
service invocation, or sending a JMS message
to a message-driven bean.
Session scoped beans across all requests in
an HTTP session. Each user of an application
gets their own instance of a session scoped
Search WWH ::

Custom Search