Exercise Solutions: Model ValidationΒΆ

Event information to add:

  1. Add a field to collect information about where the event will take place. This field should not be null or blank.

    @NotBlank(message="Location cannot be left blank.")
    private String location;
    

    Back to the exercises

  1. Add a field to collect information about the number of attendees for the event. Valid values for this field should be any number over zero.

    @Positive(message="Number of attendees must be one or more.")
    private int numberOfAttendees;
    

    Back to the exercises