Java Reference
In-Depth Information
The values displayed in the confirmation page are taken from our managed bean,
confirming that the bean's properties were populated correctly.
JSF Validation
Earlier in this chapter we discussed how the required attribute for JSF input fields
allows us to easily make input fields mandatory.
If a user attempts to submit a form with one or more required fields missing, an error
message is automatically generated.
The error message is generated by the <h:message> tag corresponding to the invalid
field. The string First Name in the error message corresponds to the value of the
label attribute for the field. Had we omitted the label attribute, the value of the
ields id attribute would have been shown instead. As we can see, the required
attribute makes it very easy to implement mandatory field functionality in
our application.
Recall that the age field is bound to a property of type Integer in our managed
bean. If a user enters a value that is not a valid integer into this field, a validation
error is automatically generated.
 
Search WWH ::




Custom Search