How to do it...

  1. Let's create a User object that will be attached to our JSF page:
@Named@RequestScopedpublic class User {        @NotBlank (message = "Name should not be blank")    @Size (min = 4, max = 10,message = "Name should be between     4 and 10 characters")    private String name;        @Email (message = "Invalid e-mail format")    @NotBlank (message = "E-mail shoud not be blank")    private String email;        @PastOrPresent (message = "Created date should be     past or present")    @NotNull (message = "Create date should not be null")    private LocalDate created;        @Future (message = "Expires should be a future date")    @NotNull (message = "Expires should not be null")    private LocalDate expires;    //DO NOT FORGET TO IMPLEMENT THE GETTERS AND SETTERS    ...
  1. Then we define ...

Get Java EE 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.