有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Thymeleaf:在变量中包含带有内部HTML的片段

我想这样做:

<div th:insert="default_page :: entire_page">
    <p>
        Hello World
    </p> 
</div>

<html th:fragment="entire_page">
    // Somehow get <p> Hello World </p> in here
</html>

换句话说,我想将片段的内部html包含到实际片段本身中

这可能吗

编辑 明确地说,我不想将“Hello World”硬编码到一个变量中,然后将其发送到片段。我真的希望能够将html放在片段调用程序中,并让它出现在片段中

我的想法是,我有一个body div,如果有意义的话,我只想在每个页面上填充内容


共 (0) 个答案