Hello, there is a page that contains links in the main menu, below this menu is the title. The question is: how to change the title by clicking on the link?
template.html
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"> <head> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <title></title> <meta name="description" content="" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" /> <link rel="stylesheet" th:href="@{/css/bootstrap-theme.min.css}" /> </head> <body> <!--[if lt IE 8]> <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a th:href="@{/http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <div class="container"> <div class="navbar navbar-default"> <div class="collapse navbar-collapse" id="responsive-menu"> <ul class="nav navbar-nav"> <li th:each="page:${pages}"><a th:text="${page.title}" th:href="${page.url}">123</a></li> </ul> </div> </div> <h1>Оглавление</h1> </div> <script th:src="@{/js/jquery-1.12.0.min.js}"></script> <script th:src="@{/js/bootstrap.min.js}"></script> </body> </html>
Method from controller
@RequestMapping("/custom/{pageName}") public String getCustomPage(@PathVariable String pageName, Model model) { GlPage p = pageService.findByUrl(pageName); if(!p.isPublished()) { return "pagemanager"; } else { ArrayList<GlPage> allPages = (ArrayList<GlPage>)pageService.getAllPages(); model.addAttribute("pages", allPages); return "template"; } }
<title>
tag, an<h1>
or something else? And how should it change, what should be substituted there and by what condition? - Slava Semushin