1
我在我的項目中使用Thymeleaf進行佈局,但無法使頁面標題變爲動態。動態頁面標題Thymeleaf Spring MVC
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>
當最終呈現頁面,我看到標題爲頁面標題沒有實際文本
在我的控制器中,我設置頁面標題屬性
modelMap.addAttribute("page-title", "Home");
我可能不會做正確的,因爲我是新來的百里香。請幫我找出解決方案。
是的,這是......工作就像一個魅力的問題!我是如何錯過這樣一個簡單的:( – Pathfinder
)如果每次我說了同樣的話我只有一分錢,我就不會工作了,很高興我能幫到你。 – code
如果你需要一個表達式添加靜態(或動態)網站標題:'