Java Reference
In-Depth Information
<property-class>
com.ensode.jpaweb.Customer
</property-class>
<value>#{Customer}</value>
</managed-property>
</managed-bean>
The <managed-property> element is used to define our managed properties. The
<property-name> element is used to indicate the managed property name; the value
of this element must match the name of the property in the managed bean's code
(in our example, both the customer and customerDAO properties are managed
properties). The value of the <property-class> element must be the fully qualified
name of the property type, and the value of the <value> attribute must match the
value of the <managed-bean-name> element for managed beans used to populate
managed properties. In our example, our JPA entity is declared as a managed bean,
using a value of Customer as its logical name, which matches the value binding
expression of #{Customer} used to populate the customer managed property of
our controller. In order to have the customerDAO property populated at runtime, our
CustomerDAO class needs to be added as a managed bean like we previously did for
the Customer class.
Trying Out Our Application
At this point, we have a complete, albeit simple, application that will gather
input from the user, populate a JPA entity from this input, and save the data to
the database. We can execute our application by right-clicking on the project and
selecting Run .
At this point the application server is started if it wasn't running already, our
application is deployed and a new window of the default web browser is
automatically opened, pointing to the URL of our application. After entering some
data into the input fields, our page looks like the following screenshot.
 
Search WWH ::




Custom Search