Use the model
attribute to declare a model object the view binds to.
This attribute is typically used in conjunction with views that render data controls, such as forms.
It enables form data binding and validation behaviors to be driven from metadata on your model object.
The following example declares an enterBookingDetails
state manipulates the booking
model:
<view-state id="enterBookingDetails" model="booking">
The model may be an object in any accessible scope, such as flowScope
or viewScope
.
Specifying a model
triggers the following behavior when a view event occurs:
View-to-model binding. On view postback, user input values are bound to model object properties for you.
Model validation. After binding, if the model object requires validation that validation logic will be invoked.
For a flow event to be generated that can drive a view state transition, model binding must complete successfully. If model binding fails, the view is re-rendered to allow the user to revise their edits.