img
<p:toolbarGroup align="left">
<p:commandButton value="Next" action="next" execute="@form" update="@form"/>
<p:commandButton value="Exit" action="exit" immediate="true"/>
</p:toolbarGroup>
</p:toolbar>
</h:form>
</ui:define>
</ui:composition>
In Listing 18-17, fields are provided with PrimeFaces' input components. Note the use of the
<p:calendar> tag, which uses PrimeFaces' Calendar component and supports a pop-up date picker.
After the project is built and deployed, test the view by clicking the Add Contact button in the list
contact view. Step 1 view will be created, as shown in Figure 18-17.
Figure 18-17. Add contact : step 1
Support of JSR-303 Bean Validation
JSF 2 supports JSR-303 Bean Validation natively. The Contact class already is annotated with constraints
on both the firstName and lastName properties. The file
/src/main/resources/ValidationMessages.properties stores the validation messages. Note the use of
the @form in the PrimeFaces' CommandButton component in Listing 18-17, which is a keyword in
PrimeFaces that triggers the update of the form. During the update process, JSR-303 validation will be
triggered automatically during the JSF application life cycle. To see it in action, in the step 1 view, click
the Next button without having entered anything. The same view will be displayed again but with the
validation messages displayed, as shown in Figure 18-18.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home