Refactoring to Fragments
Explore methods to refactor Thymeleaf templates by creating reusable HTML fragments. Understand how to reduce duplication in form inputs and improve code readability by using parameters for labels, input types, and CSS classes in fragments.
We'll cover the following...
We'll cover the following...
Reducing duplication
Our edit.html still has a lot of duplication going on per property. We should refactor this a bit and introduce a few fragments to reduce the duplication.
As a reminder, this is the HTML for a single input we currently have:
Differences between input fields
Looking at the ...