I want to extract the content of a Thymeleaf fragment to manipulate it and set it then into its target tag. The fragment itself is the title tag (I haven't even set a fragment name since the title tag alone is sufficient):
我想提取一个Thymeleaf片段的内容来操作它,然后将它设置到它的目标标记中。片段本身就是标题标记(我甚至没有设置片段名称,因为仅有标题标记就足够了):
<title>LDAP Registration</title>
The destination page (in this case the destination fragment) receives this title fragment and here I wanna manipulate the content before setting it in its place:
目标页面(在本例中为目标片段)接收此标题片段,在此我想在设置内容之前对其进行操作:
<head th:fragment="head(title)">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Name of the Website | [["${title.CONTENT}]]</title>
</head>
The upper code is just a would nice if working example to demonstrate my intention. Also worth mentioning: I don't want to set the source title into a block fragment to being able to use th:insert
, Iwant to keep the title complete and just gain access to the fragments content.
上面的代码只是一个很好的如果工作的例子来证明我的意图。还值得一提的是:我不想将源标题设置为能够使用th:Insert的块片断,我想保持标题的完整性,只想访问片断内容。
Is this possible to achieve?
这有可能实现吗?
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!