18910140161

HTML-如何在使用Thymeleaf模板布局时添加换行符?-堆栈溢出

顺晟科技

2022-10-18 12:53:17

143

如何在使用Thymeleaf模板布局时添加换行符?

这是我的HTML基础代码。

<代码><;HTML xmlns:th=";http://www.thymeleaf.org"><;head th:fragment=";公共_标题(标题、链接)<;标题th:替换=";${title}";>;布局标题<;/标题>;<;!--公用-->;<;link rel=";样式表";类型=";文本/CSS";媒体=";全部";Th:href=";@{/CSS/AwesomeApp.CSS}";>;<;link rel=";快捷方式图标";TH:href=";@{/images/favicon.ico}";>;<;脚本类型=";文本/JavaScript";th:SRC=";@{/sh/scripts/codebase.JS}";>;<;/脚本>;<;!--添加-->;<;th:block th:replace=";${links}";/>;<;/标题>;

这是HTML的主要代码。

<代码><;!文档类型HTML>;<;HTML xmlns:th=";http://www.thymeleaf.org"><;HEAD TH:REPLACE=";模板/布局/基础:公共_标题(~{:标题},~{:链接})";>;<;标题>;主标题<;/标题>;<;link rel=";样式表";th:href=";@{/CSS/bootstrap.min.CSS}";>;<;link rel=";样式表";th:href=";@{/themes/smooth/jquery-UI.CSS}";>;<;/标题>;<;身体>;主要内容<;/正文>;<;/HTML>;

下面是<html xmlns:th="http://www.thymeleaf.org"> <head th:fragment="common_header(title,links)"> <title th:replace="${title}">Layout title</title> <!-- Common --> <link rel="stylesheet" type="text/css" media="all" th:href="@{/css/ awesomeapp.css}"> <link rel="shortcut icon" th:href="@{/images/favicon.ico}"> <script type="text/javascript" th:src="@{/sh/scripts/codebase.js}"></ script> <!-- Add --> <th:block th:replace="${links}" /> </head> .

<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head th:replace="template/layout/base :: common_header(~{::title},~{::link})"> <title>Main title</title> <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"> <link rel="stylesheet" th:href="@{/themes/smoothness/jquery-ui.css}"> </head> <body> main content </body> </html>

但我想要的是:

<th:block th:replace="${links}" />
像这样换

行是我想要的。

怎样才能解决这个问题?


顺晟科技:

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航