-
Notifications
You must be signed in to change notification settings - Fork 59
Lesson 12 (Model Validation and Enums)
Courtney Frey edited this page Apr 14, 2022
·
3 revisions
- How and why to validate model data in Spring Boot.
- How to use Java Validation API annotations.
- How to employ good error handling when bad data is entered.
- What
enum
data types are how to write them in Java.
- Check with your course manager for any important announcements.
- Lesson 13 is a designated work day.
- Students should have assignment 3 completed by today's class.
- Welcome to Days 19-21!
- Assignment 3 due at end of Day 22
-
Day 19:
- Lesson 12
-
Day 20:
- Assignment 3 Work Day
- ** Day 21**:
- Assignment 3 Work Day
- Have students work on setting up MySQL. Directions in the SQL textbook.
-
You may want to introduce the topic of model validation with a more widely-scoped discussion of data handling:
a. Why is good data important?
b. How can bad data be dangerous?
-
Be sure that the students can differentiate between client and server side validation tools.
-
Discuss some commonly annotations from the Java Validation API.
-
Walk the students through the validation flow mentioned in the text, perhaps with a new sample field on the
Event
model fromcoding-events
. -
Compare strong error message and handling techniques to weaker examples.
-
Address
enum
data types:a. How to create an
enum
class and add custom properties.b. How to add an
enum
type field onto a class.c. What kind of data is handled well with
enums
.
- Today's studio asks students to add validation for the
User
model in their spa day application. If they were not able to complete the user signup studio work from the previous class, they will still be able to work on this studio. - Starter code is provided for the students in the
LaunchCodeEducation/spa-day-starter-code
repository. If they have not already added this as anupstream
remote repository in addition to their own forked version, they may need to in order to fetch the appropriate starter branch for the studio. - Students are mostly on their own to decide what their form validation should look like, although most of the work resembles the tasks we
demonstrate in the in-book
codeing-events
examples. - For those students who try the Bonus Mission, try talking with them about the relative merits of each password checking method.