I have a navbar with a list. One of the elements in the list is a dropdown, which consists of one entry. On click of this entry, I would like to see a fragment of another html page in the project.
I have a navbar html file:
<div th:fragment="navbar">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarTogglerDemo03"
aria-controls="navbarTogglerDemo03" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item dropdown">
<a
class="nav-link dropdown-toggle" href="#"
id="navbarDropdownMenuLink"
role="button"
data-bs-toggle="dropdown">
Projects
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item"
href="projects/sample.html#content"> ProjectList</a> <!--error-->
</li>
</ul>
</ul>
</div>
</nav>
</div>
And the project structure: I have a folder named projects inside src/main/resources, and within the projects folder, I have an html file sample.html and it has a fragment content
<div th:fragment="content">
</div>
---- UPDATE---
So currently, I want a fragment to be shown only when I click on the element in the dropdown "ProjectList". So I am thinking the link should happen in the href tag? But not able to understand how. any guidance here would be helpful