How to use Thymeleaf (Fragment & Replace) in Spring Framework

Sdílet
Vložit
  • čas přidán 8. 12. 2019
  • What is Thymeleaf?
    This is a spring dependency installed in the POM.XML file. It supports designing of the UI in various languages such as HTML, CSS Or Bootstrap.
    How does it help Spring framework developers?
    1. To build a more appealing User Interface by supporting HTML, CSS and JavaScript codes.
    2. To simplify the developers coding experience by calling out different sections rather than always designing elements from scratch. Elements may include the Header, Footer and body.
    Links to resources
    Index Source Codes
    Header.html Source Codes
    The codes pasted below will help you further.
    !-- In the header.html file --
    th:fragment="navbar"
    th:fragment="common-header"
    th:fragment="body-bottom-scripts"
    !-- To replace In the index.html file --
    th:repalce="common/header :: navbar
    th:replace="common/header :: common-header"
    th:replace="common/header :: body-bottom-scripts"
  • Věda a technologie

Komentáře •