Java Reference
In-Depth Information
Most default values are sensible and in most cases can be accepted. The only one we
should change if necessary is the Scope field.
Managed beans can have different scopes. A scope of request means that the bean
is only available in a single HTTP request. Managed beans can also have session
scope, in which case they are available in a single user's HTTP session. A scope of
application means that the bean is accessible to all users in the application, across
user sessions. Managed beans can also have a scope of none, which means that the
managed bean is not stored at any scope, but is created on demand as needed. We
should select the appropriate scope for our managed bean. In our particular example,
the default request scope will meet our needs.
After finishing the wizard, two things happen: a boilerplate version of our managed
bean is created in the specified package, and our managed bean is added to the
application's faces-config.xml .
The generated managed bean source simply consists of the class and a public no
argument constructor.
package com.ensode.jsf.managedbeans;
public class RegistrationBean {
/** Creates a new instance of RegistrationBean */
public RegistrationBean() {
The application's faces-config.xml contains our managed bean declaration.
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"
Search WWH ::

Custom Search