Use th:replace to create a reusable navigation component in Thymeleaf HTML with Spring Boot

Sdílet
Vložit
  • čas přidán 17. 10. 2020
  • Do you want to create an HTML fragment that can be used in multiple HTML pages? In this video, I use Thymeleaf's th:fragment and th:replace attributes to extract a nav bar from an existing page, create a fragment page for it, and then include that fragment content back in the original page. I also explore a few intermediate concepts with Bootstrap's NavBar attribute.
    Source code is freely available on GitHub: github.com/discospiff/SpringB...
    This video is part of a playlist on Microservices and Spring Boot with IntelliJ IDEA: • IntelliJ IDEA, Git, Gi...

Komentáře • 13

  • @sss9851
    @sss9851 Před 2 lety +2

    Awesome ! Made easy to understand !

    • @discospiff
      @discospiff  Před 2 lety

      I'm glad it helped! Using components is Spring Boot/Thymeleaf is a great way to have a modular, consistent design.

  • @Marc-pt4oh
    @Marc-pt4oh Před 3 lety +2

    Great explanation !

    • @discospiff
      @discospiff  Před 3 lety

      Glad it helped! Thanks for watching.

  • @marton6921
    @marton6921 Před 3 lety +1

    That's great! Thanks Brandan!

    • @discospiff
      @discospiff  Před 3 lety

      Glad it helped! Thanks for taking the time to comment.

  • @ahmadmsameh4221
    @ahmadmsameh4221 Před 2 lety +1

    thanks..
    great explanation

    • @discospiff
      @discospiff  Před 2 lety

      Thanks! I appreciate the feedback.

  • @towersofhanoi
    @towersofhanoi Před rokem

    i swear im doing the samething and it's not working lol

    • @discospiff
      @discospiff  Před rokem +1

      Do you see anything in View-Source when this renders in a browser?

    • @towersofhanoi
      @towersofhanoi Před rokem +1

      @@discospiff i don't see anything form the other file

    • @xXSkyWalkerXx1
      @xXSkyWalkerXx1 Před 6 měsíci

      @@towersofhanoi same here, lol

    • @xXSkyWalkerXx1
      @xXSkyWalkerXx1 Před 6 měsíci

      @@towersofhanoi Did you import 'thymeleaf-layout-dialect' via gradle/maven? That was my stupid mistake.