I am using thymeleaf for my front end design ,I create a nav bar and I want this nav bar work for all pages, my Requirement is make one nav bar and use this nav bar in every page ,with out define another nav bar in separate page . I create a nav bar inside my fragments folder that situated inside template folder When i call my nav bar in my index page it is not working Here is my code of index page index.html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Coursel</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" ></script>
<script type="text/javascript" src="/static/demo.js"></script>
</head>
<body>
<nav th:replace="/fragments/nav :: nav-front"></nav>
<div class="container-fluid">
here my register form codes
</div>
</body>
</html>
nav.html
<nav class="nav">
<a class="nav-link active" th:href="@{/templates/index.html}">Active</a>
<a class="nav-link active" th:href="@{/templates/index.html}">Register</a>
<a class="nav-link active" th:href="@{/templates/index.html}">Login</a>
<a class="nav-link active" th:href="@{/templates/index.html}">AboutUs</a>
</nav>
I use IntelliJ IDEA as code editor.