Thymeleaf, fragments and default parameters
Thymeleaf allows a signature of a fragment without explicit parameters like this: <div th:fragment=”my_fragment”> <p th:text=”${content}”></p> <p th:text=”${defaultParameter}”></p> </div> To call this fragment and pass content and defaultParameter you may call the fragment as follows: <!– both parameters not specified –> <div th:replace=”fragments :: my_fragment”></div> <!– only content parameter specified –> <div th:replace=”fragments :: my_fragment(content=”a”)”></div> … Read more