HTML and CSS Reference
In-Depth Information
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
The
User
managed bean is a simple Java bean with two setters and getters for the
name
and the
password
properties. The
@ManagedBean
annotation is used for registering the
User
class as a JSF managed bean.
■
the
@ManagedBean
annotation has an optional
name
attribute that describes the name of the managed bean to
be used from the JSF expressions. In the
User
managed bean, the
name
attribute is omitted; this means that the managed
bean name will be the same as the class name with the first character in lowercase, i.e., it will be used from the JSF
expressions like
#{user}
.
Note
The
@SessionScoped
annotation is used for setting the managed bean in the session scope. Other possible
values can be (
@RequestScoped
,
@ViewScoped
,
@ApplicationScoped
,
@NoneScoped
[or
@FlowScoped
, which is
supported in JSF 2.2]).
Dependencies
Now, let's move to the (
pom.xml
) dependencies of the
firstApplication
. Listing 1-9 shows the required
dependencies of the
firstApplication
on GlassFish 3.1.2.
Listing 1-9.
The GlassFish 3.1.2 Configuration in the pom.xml File
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
