-
Notifications
You must be signed in to change notification settings - Fork 59
Lesson 10 (Thymeleaf Views)
Courtney Frey edited this page Apr 14, 2022
·
4 revisions
- More about the "view" portion the MVC design pattern.
- Why using templates to design a website is a good idea.
- How to create templates using Thymeleaf.
- How to add iteration, conditionals, and fragments to a template.
- How to link a template to static resources like CSS stylesheets, scripts, images, etc.
- How to render a template using Spring controllers.
- Check with your course manager for any important announcements.
- Remind the students that they should be working on Assignment 3. After this class, they should be able to make significant progress with the required tasks.
- Welcome to Days 16 & 17!
- Assignment 3 due at end of Day 22
-
Day 16:
- Lesson 10
-
Day 17:
- Introduce Assignment 3
- Assignment 3 work day
- Assignment 3 due by end of day 22
-
Remind the students that when they start a new project, Java 13 and Gradle 6 are the versions they should use.
-
Just like lesson 8, lesson 10 includes short videos that provide guided, live-coding practice. Remind the students that the text included before and after the clips is NOT intended as a replacement for the videos.
-
For
th:text
, the syntax for mixing static text with variables is awkward. Provide an example for how to accomplish this. -
th:block
is a little more abstract than the other Thymeleaf options. Review why this element (not attribute) helps improve our template code. -
Explain why
th:unless
it not quite analogous to theelse
clause in a conditional block.-
th:if
can be made to matchth:unless
by adding anot
operator (e.g.th:unless=${num == 5}
andth:if="${num != 5}"
accomplish the same thing). Discuss whether using one format or the other is a personal preference or a common convention.
-
-
Show examples of how to use
th:fragment
andth:replace
.
- Do your best to help students who may be stuck with IntelliJ errors or warnings related to Gradle or JDK versions.
- Walk around and make sure no one is struggling with forking, cloning, and opening the starter code in IntelliJ.
- This studio is designed to be solved sequentially as the students move down the page. Trying to solve later sections before the earlier ones is an option, but this will make the overall task more difficult.
- Students might try to accomplish the iterations without using
th:block
. While this is possible, making the view work without it can be tricky. Encourage them to useth:block
, and be ready to justify why adding the element is a good idea. - Encourage your students to play around with the format of the fragments and then see how their changes affect the view.
- "Ooooo" and "Aaaaa" appreciatively if your students show you any of the bonus missions.