I want to use th:insert on a which is in the container below navbar. Each button would insert different code. I know that there is a th:if but I don't know how to use it to check if button was pressed. Maybe there is a better solution for this problem than using th:insert and th:if?
I just wanted to change content of the container instead of reloading to another page. I have already prepared html file which would be inserted into page. I am using Spring Boot, Spring MVC, Thymeleaf
Navbar code:
<nav class="navbar navbar-custom" aria-label="Desktop Navigation">
<div class="container">
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="link">Add User</a></li>
<li><a href="link">Users List</a></li>
</ul>
</div>
</div>
</nav>
Container code:
<div class="row">
<div class="col-sm-12">
<th:block th:if="(What I should insert here?)">
<div th:insert="fragments/panelFragments :: addUserFragment" />
</th:block>
<th:block th:if="(What I should insert here?)">
<div th:insert="fragments/panelFragments :: usersListFragment" />
</th:block>
</div>
</div>