background image

User Interface Component Model

<< Developing the Beans | User Interface Component Classes >>
<< Developing the Beans | User Interface Component Classes >>

User Interface Component Model

<managed-bean>
<managed-bean-name>UserNumberBean</managed-bean-name>
<managed-bean-class>
guessNumber.UserNumberBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>minimum</property-name>
<property-class>long</property-class>
<value>0</value>
</managed-property>
<managed-property>
<property-name>maximum</property-name>
<property-class>long</property-class>
<value>10</value>
</managed-property>
</managed-bean>
This declaration configures UserNumberBean so that its minimum property is initialized to 0, its
maximum
property is initialized to 10, and it is added to session scope when it is created.
A page author can use the unified EL to access one of the bean's properties, like this:
<h:outputText value=
"#{UserNumberBean.minimum}"/>
For more information on configuring beans, see
"Configuring a Bean" on page 311
.
User Interface Component Model
JavaServer Faces UI components are configurable, reusable elements that compose the user
interfaces of JavaServer Faces applications. A component can be simple, such as a button, or
compound, such as a table, which can be composed of multiple components.
JavaServer Faces technology provides a rich, flexible component architecture that includes the
following:
A set of UIComponent classes for specifying the state and behavior of UI components
A rendering model that defines how to render the components in various ways
An event and listener model that defines how to handle component events
A conversion model that defines how to register data converters onto a component
A validation model that defines how to register validators onto a component
This section briefly describes each of these pieces of the component architecture.
User Interface Component Model
Chapter 10 · JavaServer Faces Technology
299