【发布时间】:2016-05-15 08:32:01
【问题描述】:
我在项目中使用 Thymeleaf 进行布局,但无法动态获取页面标题。
Layout.jsp
<head th:fragment="headerfragment">
<title th:text="@{page-title}"></title>
<!-- Bootstrap Core CSS -->
<link th:href="@{/resources/css/bootstrap.min.css}" rel="stylesheet"
type="text/css" />
</head>
Page.jsp
<head th:include="layout :: headerfragment"></head>
当最后一页被渲染时,我看到的标题是 page-title 而不是实际的文本
在我的控制器中,我设置了 page-title 属性
modelMap.addAttribute("page-title", "Home");
我可能做得不对,因为我是 thymeleaf 的新手。请帮我找出解决方案。
【问题讨论】:
标签: spring-mvc thymeleaf